Guest OS shutdown task is failing from the vCenter Server with the error : "The request to Power off this virtual machine failed because the corresponding VMware Tools script did not run successfully. If you have configured a custom power-off script in this virtual machine, make sure that it contains no errors."
vCenter Server 7.x
vCenter Server 8.x
Open-vm-tools 12.3.5
The scripts in the /etc/vmware-tools directory are in following the naming convention <power-operation>-vm-default.old.0 and the files are not executable.
The <power-operation>-vm-default file is used to perform the power operations on the VM using open-vm-tools, the script searches for the file name with the format <power-operation>-vm-default for execution and changing the power state ( Powered on, Powered off, Suspend, Resume)
Since the file name is in the format, the following error is received in the log file /var/log/vmware-vmsvc-root.log on the VM:
[powerops] [1153] Executing script: '/etc/vmware-tools/poweroff-vm-default'
[powerops] [1153] Error starting script: Failed to execute child process "/etc/vmware-tools/poweroff-vm-default" (No such file or directory)
[1153] VixTools_ProcessVixCommand: command 62
[1153] ToolsDaemonTcloReceiveVixCommand: command 62, additionalError = 17
[1153] Executing script for state change 'OS_Halt'
[1153] Executing script: '/etc/vmware-tools/poweroff-vm-default'
[1153] Error starting script: Failed to execute child process "/etc/vmware-tools/poweroff-vm-default" (No such file or directory)
[1153] Initiating halt
After changing the file name, the file needs to be made executable, if not, the following error will be encountered in the log file /var/log/vmware-vmsvc-root.log :
[1157] Executing script for state change 'OS_Halt'.
[1157] Executing script: '/etc/vmware-tools/poweroff-vm-default'
[1157] Error starting script: Failed to execute child process "/etc/vmware-tools/poweroff-vm-default" (Permission denied)
[1157] Executing script for state change 'OS_Halt'.
[1157] Executing script: '/etc/vmware-tools/poweroff-vm-default'
[1157] Script exit code: 1, success = 0
[1157]
Initiating halt.
Note : Please take snapshot of the VM prior to making the changes.
mv <power-operation>-vm-default.old.0 <power-operation>-vm-default
chmod 755 <power-operation>-vm-default
Please refer to the following KB article for information on Broadcom VCF support for open-vm-tools : VMware support for open-vm-tools