VMware Cloud Community
hansis
Contributor
Contributor
Jump to solution

vmware-vim-cmd check vmwaretools available

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

0 Kudos
1 Solution

Accepted Solutions
MKguy
Virtuoso
Virtuoso
Jump to solution

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.

-- http://alpacapowered.wordpress.com

View solution in original post

0 Kudos
2 Replies
MKguy
Virtuoso
Virtuoso
Jump to solution

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.

-- http://alpacapowered.wordpress.com
0 Kudos
hansis
Contributor
Contributor
Jump to solution

thank you.

no my script is perfect Smiley Happy

0 Kudos