Hard kill VM in vSphere 4 and 5

First of all you need PowerCLI for this to work. Next, try the following sequence of commands:

      - Connect-VIServer -Server - directly connection on problematic ESXi server or vCenter
      - $esxcli = Get-EsxCli -Server - fetching of useful command (without "Server" if directly on ESXi)
      - $esxcli.vms.vm.list() | Format-Table -Property DisplayName, WorldID - find problematic VM by worldID
      - $esxcli.vms.vm.kill("soft", [worldID]) - "kill" with 3 options: soft, hard and force (first try with hard and only in really big problems use force...without "[]" of course)

Or, if just want to kill VM process in ESXi 3.5-5 directly (without need of PowerCLI) then this is useful too:

       - ps | grep vmx
which gives something similar to:
      7662 7662 vmx /bin/vmx
   7667 7662 vmx /bin/vmx
   7668 7662 mks:VirtualMachineName /bin/vmx
   7669 7662 vcpu-0:VirtualMachineName /bin/vmx


Underscored ones are parents ID's which needs to be killed. So this is it:
      kill [parents ID] or

      kill -9 [parents ID] 





Comments

Popular posts from this blog

NSX ALB LetsEncrypt with DNS-01 challenge - BIND example

NSX ALB routing - multiple floating IP and BGP setup

VMware SD WAN - multiple locations - LAN IP address space overlapping with NAT