This post http://communities.vmware.com/message/2068218#2068218 got me thinking about various DR situations.
Essentially, what the op was saying was that even though he has a generator, it doenst work. Another variable that can throw wrenches in someones day.
Not going into reasons why someone doesn’t have other DR plans, sometimes a graceful shutdown is much more efficient then a looming hard shutdown.
Using the script from herseyc I'm going to run it on my infrastructure as a demo.
# Get All the ESX Hosts
$ESXSRV = Get-VMHost
# For each of the powered on VMs with running VM Tools
Foreach ($VM in ($ESXSRV | Get-VM | Where {$_.PowerState -eq "poweredOn" -and $_.Guest.State -eq "Running"})){
# Shutdown Guest
write-host "Shutting down $VM"
$VM | Shutdown-VMGuest -Confirm:$false
}
Pasted from <http://communities.vmware.com/message/2068218#2068218>
You will need powercli already installed.
Here is my powered on vms list
Lets see what happens when we run the script
As we can see the script initiated a shutdown on all the running guests on the vsphere instance.
Looking at the task bar of the client for vsphere you can see guests going down.
Even my vcenter went down, as planned
What is this? We have a server still running! I am connete to the host here.
Looking at the summary, you can see vmware tools is not installed.
So a shutdown command wouldn’t be well received.
If the vmware tools is not installed or has an issue and isn't running then the server will still be running and you wouldn’t know it if your vcenter is virtualized.
Possible solution can be a script that runs on the vcenter server that stops the vmware tools service! Run this first and then run the shutdown command so your vcenter is the last to go.