VMware Communities
WhiteKnight
Hot Shot
Hot Shot

Improvement Suggestion: Suspend VMs Automatically On Host Log-off/Shut-down

When logging of or shutting down the host OS (Windows), VMware Workstation should automatically suspend all running VMs (incl. VMs running in the background) immediately.

Currently on Windows 7 Workstation just hangs when a user is logging off at the host OS. At the same time VMs running in the background are simply abruptly shut off. Even though NTFS is a transactional file system, simply cutting off power is something that's never to be regarded a good idea.

Hence, I'd like to suggest to implement a graceful shutdown behaviour of Workstation.



[VMware]: Workstation 17 Pro; --
[host]: Windows 10x64 host; --
[guests]: Windows 10x64, Windows 8x64.
15 Replies
RDPetruska
Leadership
Leadership

VMware Server can be configured to start up and shut down virtual machines with the host, as that product is designed for non-interactive VMs and Servers. Workstation and Player are designed for interactive VMs and Desktop PCs. I submit that it is a lazy user who doesn't shut down/close running applications when logging off or shutting down their PC...

Reply
0 Kudos
khughes
Virtuoso
Virtuoso

I submit that it is a lazy user who doesn't shut down/close running applications when logging off or shutting down their PC...

I would agree with this. I run into the same problem sometimes when I do a quick shutdown before all my VM's are powered off. I just cut the power because I don't care about those VM's but the ones that I care about I make sure I shut them down properly. We're talking about, what... an extra 10-15 seconds to sit there and actually shut them down properly?

  • Kyle

-- Kyle "RParker wrote: I guess I was wrong, everything CAN be virtualized "
Reply
0 Kudos
WhiteKnight
Hot Shot
Hot Shot

Well, it's not only lazy users that get into this problem. Sometimes things have to go quick. Lunch, Meetings etc.

Well grown programs take care of such situations and don't allow for critical situations to "just happen". I'd call taking care of any known situations a professional way of programming. Programs are supposed to take care of routines. That's what they are made for.



[VMware]: Workstation 17 Pro; --
[host]: Windows 10x64 host; --
[guests]: Windows 10x64, Windows 8x64.
Reply
0 Kudos
RDPetruska
Leadership
Leadership

>I'd call taking care of any known situations a professional way of programming. Programs are supposed to take care of routines. That's what they are made for.

You forget the basic concept of what Workstation IS, though. All Workstation provides, at the heart, is a blank computer. It does not, by default, know or care about the guest OS running inside of that computer. That is the user's concern.

Reply
0 Kudos
WhiteKnight
Hot Shot
Hot Shot

That's not correct.

.

Workstation provides a framework to control a number of computers. These computers are just modules Workstation deals with. But Workstation IS in fact the framework around them to interact with.

And, hence, of course it knows the concept of a host and guests. The System Tray icon proves that.

Monitoring the running machines, Workstation has responsibility to provide comfortable support for them.

The user's concern is just to manually start/stop/use the machines that are running. It's not his concern to share monitoring responsibility with Workstation. You can't make the client responsible for a service to run flawless. It's the service's responsibility.

As I wrote before, it's a program's task to take care of routines.



[VMware]: Workstation 17 Pro; --
[host]: Windows 10x64 host; --
[guests]: Windows 10x64, Windows 8x64.
Reply
0 Kudos
kingneutron
Expert
Expert

--I agree with you. As a sysadmin, I take the trouble to shutdown things as nicely as possible before logging off / shutdown Host -- but normal casual end-users should be protected by default against possible data loss and damage. Vmware Workstation should do the "heavy lifting" here by making an attempt to suspend all running VMs instead of current behavior ( which is admittedly kinda dumb. )

--i.e. if $USER initiates Logoff or Host shutdown, have *at least an option in Workstation Preferences* or a process that auto-suspends all running VMs without prompt. I wrote a wrapper-script to do this on Linux hosts when somebody hits Ctrl-Alt-Del to shutdown the PC, to protect against $ABSENT-MINDED-SYSADMIN.

--Bah, this stupid forum software is mangling my code, so I'll just attach the files.

./. If you have appreciated my response, please remember to apply Helpful/Correct points. TIA

Message was edited by: kingneutron

./. If you have appreciated my response, please remember to apply Helpful/Correct points. TIA
Reply
0 Kudos
kingneutron
Expert
Expert

Forum software is DOUBLY stupid by not attaching BOTH files...

./. If you have appreciated my response, please remember to apply Helpful/Correct points. TIA

./. If you have appreciated my response, please remember to apply Helpful/Correct points. TIA
Reply
0 Kudos
kingneutron
Expert
Expert

--FYI the only problem I have seen so far with this approach, is if the shutdown wrapper suspends your VM you may have to manually delete .LCK files in the VM dirs before you can start them back up.

./. If you have appreciated my response, please remember to apply Helpful/Correct points. TIA

./. If you have appreciated my response, please remember to apply Helpful/Correct points. TIA
Reply
0 Kudos
WhiteKnight
Hot Shot
Hot Shot

kingneutron schrieb:--I agree with you. As a sysadmin, I take the trouble to shutdown things as nicely as possible before logging off / shutdown Host -- but normal casual end-users should be protected by default against possible data loss and damage. Vmware Workstation should do the "heavy lifting" here by making an attempt to suspend all running VMs instead of current behavior ( which is admittedly kinda dumb. )

Exactly. I'm a software architect and I'm about to use VMware to have distinct development environments for each customer. From your perspective I'm a "default" casual user.

All the necessary code is already present in VMware workstation, it's triggered when you shut down Workstation and select Suspend. So implementing this safety precaution would just be a small step for WMware (I expect no more than 2 - 4 short lines of code) but a great leap for mankind Smiley Wink

---

PS: Thanks for these valuable scripts! Cool scripts you have written! Do you know why the lock files are left?

I've taken your idea and put it into a DOS command line:

FOR /F "skip=1 tokens=*" %a IN ('VMRUN LIST') DO VMRUN SUSPEND "%a"



[VMware]: Workstation 17 Pro; --
[host]: Windows 10x64 host; --
[guests]: Windows 10x64, Windows 8x64.
Reply
0 Kudos
WhiteKnight
Hot Shot
Hot Shot

I've just tried to execute this script at user log off... Unfortunately this is not a solution on Windows. Because Windows waits for Workstation to close before execution the log off script.

So it still is not only an option but a requirement for Workstation to provide this functionality.



[VMware]: Workstation 17 Pro; --
[host]: Windows 10x64 host; --
[guests]: Windows 10x64, Windows 8x64.
Reply
0 Kudos
philshort
Contributor
Contributor

Can I just add to this discussion that the host shutdown may not be initiated by the user anyway; Last night one of my VM's was mangled by WIndows Update rebooting my host. Normally I have this disabled, and I'm not sure how or why it happened, but there you go, despite my best intentions it did reboot the host.

Would it hurt to have an option to suspend any running VM's if the host is closing down?

SanderStoks
Contributor
Contributor

I submit that it is a lazy user who doesn't shut down/close running applications when logging off or shutting down their PC...

I submit that it's Windows "Professional" which decides to reboot the system in my absence and without my permission.  Like philshort noted, it would be *very* nice if VMware chose to suspend the vms if at all possible, instead of powering them down.  I lost work due to this.  I have found a way to prevent Windows from auto-rebooting in my absence (which should obviously be the default - my jaw is still dropped at this audacity; apparently installing Silverlight (which I found on my system this morning) was more important than what I was doing) but VMware could handle this more gracefully too.  Or is there a setting/option I have missed?

piggyz
Enthusiast
Enthusiast

Well, when you shutdown or logoff a machine without suspending your VMs before, or if you have any other program with unsaved data, Windows and many other OSs alert you and offer to block the logoff or shutdown process.

Reply
0 Kudos
petarpan
Contributor
Contributor

This became lengthy thread, so let me summarize it.

Original improvement request was to add Guest "pause" if host does shutdown (or similar feature to suspend guest).

Reasons for it were:

- Windows, or whatever installed applications (e.g. antivirus, internet explorer, ...) initiates update and reboots without asking a user to confirm the reboot.

- Users wish more features for the money.

- Low UPS power level while on running batteries in the case of accidental power loss (and i must shutdown system properly, not sleep nor hibernate are not suitable due to some old devices and drivers we use)

Reasons against were:

- User is "lazy" and non-responsible

- VM Server is to be purchased for such options

I am really surprised with "Reasons against" because some are offensive, and others who don't need more "features per investment" looks they didn't invest anything (I hope I am not right).

Request is reasonable and hope to see "pause on host shutdown - resume on startup" feature soon.

In the meanwhile I would share my temporary (not so good) workaround:

- Make script that you will give to windows to execute before shutdown and assign another script for startup.

Example of bat file to suspend vmware images:

C:\Progra~2\VMware\VMWARE~1\vmrun.exe -T ws suspend K:\VM_Images\Image_xx01\Image_xx01.vmx nogui

C:\Progra~2\VMware\VMWARE~1\vmrun.exe -T ws suspend K:\VM_Images\Image_xx02\Image_xx02.vmx nogui

Setup startup/shutdown script in windows 8 or server:

Assign Computer Shutdown Scripts

Example of bat file to startup vmWare images:

C:\Progra~2\VMware\VMWARE~1\vmrun.exe -T ws start K:\VM_Images\Image_xx01\Image_xx01.vmx nogui

C:\Progra~2\VMware\VMWARE~1\vmrun.exe -T ws start K:\VM_Images\Image_xx02\Image_xx02.vmx nogui

Good luck.

PS: There are few annoying issues with my solution and I don't like it - therefore I wanted more professional solution from vmWare.

- startup script that might be executed by system user. This would make vmWare images invisible after you login.

- to avoid above, you would need to setup autologin http://pcsupport.about.com/od/windows-8/fl/auto-logon-windows-8.htm OR run vmWare using RunAs or PxExec in your startup script to specify desired user.

- in my case i needed also to modify windows settings for UPS to react as soon as possible on battery mode, so vmware images have enough time to suspend.

Reply
0 Kudos
munrobasher
Enthusiast
Enthusiast

Just a "me too" response here. I'm currently running a lab Windows domain environment for testing on my development PC including a domain controller. I usually shut my PC down at night but if I forget to manually pause or shutdown my VMs, then simply get turned off. Not nice for even a lab server.

So pause on logoff and/or shutdown would be a nice feature.

As a workaround, I've knocked up a PowerShell script to use vmrun to suspend the VMs. The script runs fine, just need to get it working with group policy shutdown scripts.

Reply
0 Kudos