How to remove suspended state of a VM that will not power on using vSphere Client (4.1)

I was performing maintenance on an ESXi host last night and needed to suspend a virtual machine and reboot the Host. After the reboot I attempted to restart the VM and this attempt returned a CPU masking error and the VM could not power on. Looking round VMware KB articles I found this and thought I would add the resolution that I used.

  • Enable remote tech support mode using the vSphere Client or DCUI.
  • Open an SSH client like Putty and connect to the ESXi Host.
  • Run the following command to find the VM filepath:

vim-cmd vmsvc/getallvms

  • Identify the file path for the virtual machine (indicated by the highlighted box below)

  • Change directory by using:

cd /vmfs/volumes/<Datastore name>/<virtual machine name>

  • Open the .vmx file using “vi”. Run the following command

vi <virtual machine name>.vmx

  • press the “i” key to enter insert mode in “vi”
  • find the line that starts with sched.swap.derivedName and remove it. This removes the .vswp reference for the VM.
  • find the line that starts with checkpoint.vmState and remove it. This removes the .vmss reference for the VM.
  • press the “esc” key and then “:wq” to write the changes and quit “vi”
  • Run the following command to find the VM vmid:

vim-cmd vmsvc/getallvms

  • find the vmid number for the VM
  • Run the following command to change the VM state to be powered-off:

vim-cmd vmsvc/reload <vmid>

The VM should now show as powered off and will restart as without the CPU mask error.