Quantcast
Channel: VMware Communities: Message List - vSphere Hypervisor
Viewing all articles
Browse latest Browse all 3837

Re: How to stop all VM quickly ?

$
0
0

Could not use Powershell scripts even after reading a lot about loading snap-ins/modules but I probably missed something. :-/

 

So I installed VMware-vSphere-CLI (version 5.5.0 for me) so I had the vmware-cmd.pl script and commands so that I could run the following DOS script by a scheduled task :

cd /D "C:\Program Files (x86)\VMware\VMware vSphere CLI\bin"

set login=-H myserver -U root -P mypassword

 

 

 

rem vmware-cmd.pl %login% -l to get the VM raw name

set vm=/vmfs/volumes/53b17247-36fb17f7-93f8-002590534d58/VM/VM.vmx

 

 

 

rem If I can get the VMtools status, the OS runs in the VM, so I shutdown the guest. Otherwise, I only have to hard shutdown the VM.

vmware-cmd.pl %login% %vm% gettoolslastactive | findstr /C:"= 0"

if %ERRORLEVEL% == 0 (

  vmware-cmd.pl %login% %vm% stop hard

) else (

  vmware-cmd.pl %login% %vm% stop

)

 

 

 


Viewing all articles
Browse latest Browse all 3837

Trending Articles



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