Hello,
We have about 400 VM's (Windows and Linux) running on ESX 3.5 and ESXi 4.1 . We are movig this infrstructure so need to shutdown all the VM's.
Can I automate this process so that we do not have to individually power down each VM?
Thanks in advance!
As long as all your VMs have vmware tools installed you should just be able to do a
Get-VM | Shutdown-VMGuest
This will grab all the VM and shutdown their OS
If you wanted to test this on just a few VMs you could pick a folder and do
Get-VM -location "FolderName" | Shutdown-VMGuest
Or even just one VM
Shutdown-VMGuest -vm "VMName" OR Get-VM "VMName" | Shutdown-VMGuest
Hope this helps
CRad14's post explains a way of doing this. Alan Renouf has also blogged a script on how to shutdown VI before too - it goes a step further and will also shutdown your ESXi hosts too (unless you are running your vCenter server(s) as VMs too though). Check it out here: http://www.virtu-al.net/2010/01/06/powercli-shutdown-your-virtual-infrastructure/ (it goes without saying, be careful playing with cmdlets that will shutdown anything - VMs, Hosts etc)!
Finally, if you use any of the above for shutting down your VMs, if you have any which do not have VMware tools installed and do not shutdown with the above script, do something like this to get a list back of VMs still running which can then be manually powered down:
If you would like a way of shutting down VMs with Windows guests which do not have VMware Tools installed for some reason, you could use the normal PowerShell Cmdlet Stop-Computer. This can shutdown remote computers too. Example below:
Stop-Computer -Computerame MYSERVERNAME -Force
Hope that helps!
Sean