Hello!
I want to make a script (with bash) to shutdown my VMs.
with vmware-vim-cmd vmsvc/power.shutdown ID I can shutdown my VM.
But If vmware-Tools are note running I want to turn off the VM hard.
How can I check if vmware-tools are available and how can I turn off VM without vmware-tools?
thx.
hansi
Using the vim-cmd, you can use use the vmsvc/get.guest to check if the tools are running:
# vim-cmd vmsvc/get.guest 28 | grep toolsRunningStatus
toolsRunningStatus = "guestToolsRunning",
# vim-cmd vmsvc/get.guest 18 | grep toolsRunningStatus
toolsRunningStatus = "guestToolsNotRunning"
You can also include a vim-cmd vmsvc/power.getstate in your script to check if the VM is actually powered-on, since the tools status will be guestToolsNotRunning on a powered-off VM obviously.
To hard power-off VMs, use the vmsvc/power.off option.
Using the vim-cmd, you can use use the vmsvc/get.guest to check if the tools are running:
# vim-cmd vmsvc/get.guest 28 | grep toolsRunningStatus
toolsRunningStatus = "guestToolsRunning",
# vim-cmd vmsvc/get.guest 18 | grep toolsRunningStatus
toolsRunningStatus = "guestToolsNotRunning"
You can also include a vim-cmd vmsvc/power.getstate in your script to check if the VM is actually powered-on, since the tools status will be guestToolsNotRunning on a powered-off VM obviously.
To hard power-off VMs, use the vmsvc/power.off option.
thank you.
no my script is perfect