VMware Communities
d1567010
Contributor
Contributor

How to programmatically shut down a suspended VM?

So all my Workstation VMs are automated inside and all that's left for me is to automate their boot when my computer boots.

I've tried using vmrun.exe, the command line program to do so and it looks like it has everything I'd need (booting, shutting VMs down), aside from one option.

Because when I turn off my computer, all of the VMs are automatically suspended and they keep the suspension status after my computer boots as well. So using vmrun to start them will resume suspended state, which is not what I want. But using vmrun to stop a suspended VM will return an error saying that the VM isn't on.

For now I have to do it manually each time I enable my computer by clicking the "Shut down" button on each suspended VM.

With that being said, I'm looking for a different way to shut down a suspended VM without user input. Either that or to have VMs not go into shutdown state once my computer tries to shut down.

0 Kudos
2 Replies
PascalG
Contributor
Contributor

I have a similar issue. One option is to vmrun start the suspended machine and then to vmrun stop it... But, if doing this with a script, we need to know the state of the machine in order to be sure that we do not vmrun start/stop VMs which are already stopped -- because it will be a bit silly.

0 Kudos
wila
Immortal
Immortal

Hi,

There's no graceful shut down of a suspended VM.

To shut down, like the other poster says, you'll have to first resume. After resuming the VM you can ask the OS in the VM to shut down via vmware tools.

The only alternative is a power off.

But that's not a graceful thing to do as it is basically a "pull the power cord" type of solution.

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos