Quantcast
Channel: VMware Communities : Discussion List - ESXi
Viewing all articles
Browse latest Browse all 8132

Help scripting graceful shutdown of VMs via SSH

$
0
0

Hello,

 

I would like to script the graceful shutdown of my running VMs by connecting to my host using SSH and running some commands.

 

I have the appropriate command to shutdown a VM gracefully as:

vim-cmd vmsvc/power.shutdown VMID

 

What I need assistance with, is to try and use:

vim-cmd vmsvc/getallvms

To try and only return a list of VMs currently running, and to also filter out one specific VM (which the script will effectively be run from).

 

Is there a way to either do this directly in the commands, or can I capture the output of vim-cmd and interpret it in a script to achieve this?

 

Cheers

Eds


Viewing all articles
Browse latest Browse all 8132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>