Hello,
I wonder if it is possible to run a script to check the status of a particular virtual machine, and even if the system is locked reset it
Thanks...
You mean the overall status ?
Get-VM -Name MyVM | Select @{N="OverallStatus";E={$_.ExtensionData.OverallStatus}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Luc
I will explain, Monday realized that a virtual machine not responding "ping" and the VMware Tools status was Not Running, I opened the console and saw that the machine was locked, so I was thinking of a script to check the machine status , and the same answer as the offline script reset the machine automatically
Thanks..
You mean locked in the sense that you couldn't interact with the guest OS from the console ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Exactly, for some reason the machine was locked, did not answer, so I had to make a guest restart manually
That situation is not always easy to detect I'm afraid.
You can test with a ping to the guest OS and check if the VMware Tools are not running.
Something like this
$vm = Get-VM -Name MyVM
if(!(Test-Connection -ComputerName $vm.Guest.HostName -Quiet) -and
$vm.Guest.State -eq "NotRunning"){
Stop-VM -VM $vm -Confirm:$false -Kill
Start-VM -VM $vm
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I'll do some tests and give feedback
thank you
Apart from scripting something on your own maybe you should look into the VM monitoring feature of HA instead, which is designed to do exactly what you want: Resetting a crashed/unresponsive guest OS.
http://www.yellow-bricks.com/2011/07/20/testing-vm-monitoring-on-vsphere-5-0/