I have a guest on one of our VMware ESXi 4.1 hosts, with the state (in the summary tab) saying "Powered Off" and VMware Tools "Not running", but the guest IS running fine (can ping it, can remote desktop to it, and yes the VMware tools are running on the guest O/S.)
I have tried the restart management agents command, and done it a few times for good measure ( /sbin/services.sh restart ); and tried stopping and restarting VMware tools in the guest O/S, all to no avail. Now, I could run the vm-support -X command to kill the guest, and then get it back; or I could move other guest machines off the host and reboot the host; or could shut the guest down, wait a bit, and then power it back on; but I don't see why I should take either of these measures just to get a VMware guest that is running fine, to correctly display its state!
The only real problem is that with the guest state and VMware tools status not being reported correctly, the guest backup does not work, so I will eventually have to hit it on the head some time (the controlled shutdown, wait, and power back on is the preferred method.)
Anyone know how to restore a running guest VM to register its state correctly, without having to restart/kill the guest or restart the host?
And anyone know why it sometimes happens that a VM guest is running fine, but the host and vCenter reports its state as powered off?
Not sure why it happens sorry but your line of reasoning to resolve is correct.
Firstly try to power off the VM individually if you can.
Secondly move all VM's off the host and then reboot the host.
If you leave that guest running as it is then you will eventually have major problems doing standard maintenance on your hardware.
The solutions you have proposed are correct. It does happen and if you have gone through the easy things to try you are left with the brutal ones. You will eventually need to deal with the problem. Fix it on your timetable not in some panic situation.
I've encountered an issue like this related to OEM CIM drivers. Here's the VMware KB associated to it.
This bug caused a number of my VMs to show as powered off when they were actually on, and later as "Invalid".
I've marked Chris Wahl's response as a helpful answer as points to what might be causing the problem / the cause, and will update the hosts.Thanks Chris, and thanks to all the other replies too.
The answer to the question of getting a VM guest that is running perfectly well to correctly register its power state as being on was simple. The VMs that correctly showed power state as being on were vMotioned off the affected host, and then a restart of the management agents ( /sbin/services.sh restart ) brought back the other machines (had to do this twice as at one stage had 7 machines saying they were off but actually on, first restart bought 4 back, then after vMotioning off, 2nd restart got back the rest.)
Problem resolved without recourse to having to interfere with the VM guest in any way - very good since this is a hosting environment and don't want to make clients angry.