VMware Cloud Community
halr9000
Commander
Commander
Jump to solution

How to kill a stuck VM?

I don't know the answer to this one. What do you guys got? It can't involve logging into the service console. Smiley Happy

Hal Rottenberg

Author of the upcoming book: Managing VMware Infrastructure with PowerShell

Co-Host, PowerScripting Podcast (http://powerscripting.net)

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
0 Kudos
1 Solution

Accepted Solutions
admin
Immortal
Immortal
Jump to solution

I don't believe there's an API for this today.

I can see a few possible workarounds:

  1. VMotioning the VM to a different host and back again may solve the problem.

  2. If that works, maybe there's some way to trick the system to VMotion the VM to itself?

  3. If that doesn't work, you can VMotion non-misbehaving VMs somewhere else and reboot the host Smiley Sad

View solution in original post

0 Kudos
5 Replies
admin
Immortal
Immortal
Jump to solution

I don't believe there's an API for this today.

I can see a few possible workarounds:

  1. VMotioning the VM to a different host and back again may solve the problem.

  2. If that works, maybe there's some way to trick the system to VMotion the VM to itself?

  3. If that doesn't work, you can VMotion non-misbehaving VMs somewhere else and reboot the host Smiley Sad

0 Kudos
akieffer
Enthusiast
Enthusiast
Jump to solution

Run ps -elf | grep "vm name"

Then kill the pid of the stuck vm.

0 Kudos
halr9000
Commander
Commander
Jump to solution

Run ps -elf | grep "vm name"

Then kill the pid of the stuck vm.

I'm afraid you missed the point. Smiley Happy This forum is about the VMware Toolkit for Windows. We need to know how to automate this, and to do so from Windows PowerShell. Carter pointed out that there is no way to do it from within the SDK. That means we could use plink.exe from the putty project to, in effect, do what you are talking about. Now we just need it in a script.






Author of the upcoming book: Managing VMware Infrastructure with PowerShell

Co-Host, PowerScripting Podcast (http://powerscripting.net)

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
0 Kudos
admin
Immortal
Immortal
Jump to solution

Hal,

I added a function, Stop-TkeVMProcess that will do this to the community extensions. It relies on plink. You can pipe a bunch of VMs in if needed. One drawback at the moment, it assumes the VMs are either all on the same ESX host or the ESX hosts all have the same password. Extensions here.

halr9000
Commander
Commander
Jump to solution

That's cool Carter, I will have to mention the extensions in my book, they definitely have a bright future.






Author of the upcoming book: Managing VMware Infrastructure with PowerShell

Co-Host, PowerScripting Podcast (http://powerscripting.net)

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
0 Kudos