gianlucacornacchia / vmware-auto-suspend

Auto-suspend all VMs in case of a Windows shutdown or logout

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SuspendRunningVMs.bat

Contains the solution to this question:

How do I set up VMWare Workstation (running on a Windows host) to automatically suspend all guest VM's when the host OS shuts down or restarts?

This repo essentially contains a solution to the annoying issue of losing your virtual machine state if Windows decides to log off and/or reboot. It does this by running the script when it detects certain events associated with a logout.

While this feature does exist in VMWare, you have to convert your VM into a Shared VM, which involves losing a lot of features. This doesn't have that drawback. The original solution was published by @drueter on the VMWare Community forum.

Installing

  1. Download the xml file.
  2. Open a CMD or Powershell terminal and navigate to where the file was downloaded
  3. Run schtasks /create /TN "Auto Suspend VMWare instances" /XML vmware-auto-suspend.xml
  4. Download the script and put it in C:/.

If you choose to place the script somewhere else, you need to open the Windows Task Scheduler, edit the ""Auto Suspend VMWare instances" task and browse to where the script is located.

Background

After a long and bumpy road through both StackExchange and the VMWare Community Forums I finally was given a hint to a useful thread that contained exactly what I was interested in.

But as that was kind of hidden and in a form that is hard to contribute to if you find bugs in the solution, I decided to improve on this situation by dumping the solution on GitHub. That fixes troublesome copy-paste issues.

About

Auto-suspend all VMs in case of a Windows shutdown or logout


Languages

Language:Batchfile 100.0%