2 Replies Latest reply on Nov 23, 2019 7:08 AM by wila

    How to programmatically shut down a suspended VM?

    d1567010 Lurker

      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.

        • 1. Re: How to programmatically shut down a suspended VM?
          PascalG Novice

          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.

          • 2. Re: How to programmatically shut down a suspended VM?
            wila Guru
            User ModeratorsCommunity WarriorsvExpert



            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.




            | Author of Vimalin. The virtual machine Backup app for VMware Desktop Products
            | Vimalin : Automated backups for VMware Fusion and VMware Workstation Professional
            | More info at https://www.vimalin.com
            | Twitter @wilva
            | VMware Wiki at http://www.vi-toolkit.com