VMWare esxi Unable to connect to the mks the operation is not allowed in the current state

Unable to shut down, migrate or doing pretty much any operation to a VM with error message including “operation is not allowed in the current state”?

Solution might be enabling ssh on the esxi  host, login and try:

  1. Run the esxtop utility using this command:esxtop
  2. Press c to switch to the CPU resource utilization screen.
  3. Press Shift+v to limit the view to virtual machines. This may make it easier to find the Leader World ID in step 6.
  4. Press f to display the list of fields.
  5. Press C (uppercase) to add the column for the Leader World ID.
  6. Identify the target virtual machine by its Name and Leader World ID (LWID).
  7. Press k.
  8. t the World to kill prompt, type in the Leader World ID from step 6 and press Enter.
  9. Wait 30 seconds and validate that the process is not longer listed.

In vSphere client, check if the machine detects it is shut down, if it doesn’t happen right click and choose shut down, hopefully this will work now.

Ref: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1014165