1

At work we've got a Windows Server 2003 VM that we want to shut down when the host operating system (Linux) shuts down. We have this working except for when a user has logged in and locked the screen. It seems that Windows won't shut down when the screen is locked.

We're investigating ways to prevent auto-lockout from happening when the user is inactive, but that's not really ideal. Is there something we can configure or some way we can script it so Windows will shut down no matter what any user's up to?

If we don't shut Windows down cleanly we risk corrupting the entire VM. In our environment once the host OS receives its ACPI signal we have 120 seconds to shut everything down before the system is forcibly powered off.

We've googled this quite a bit but no luck so far. We're still looking for that smoking gun registry setting.

2 Answers 2

1

Use the remote shutdown function in MSRPC, with the "force" flag to override locked sessions or hung processes. If Samba is installed, it can be used as:

net rpc -S vm-hostname shutdown -t 0 -f

(The equivalent Windows command is shutdown -m \\vm-hostname -s -t 0 -f.)

Alternatively, ssh into the Windows VM and run shutdown -s -t 0 -f that way. There are several free SSH servers for Windows, such as Bitvise WinSSHd.

All three methods (even if you run shutdown over SSH or locally) require an account with the SeRemoteShutdown privilege, an administrator by default.

1

Windows has an EMS feature that gives you access via the serial port. While you can actually get a working cmd.exe instance via the serial, you can also log into a simple console that lets you issue a shutdown command as well. This console should even work if the system has crashed or your virtual networking is shutdown or horribly corrupted (you can even get the last BSOD text IIRC).

This is when I was running Windows Server 2003 under qemu, which allowed redirecting of the virtual COM1 to a local "telnet"-like port. So I was able to use expect to issue a clean shutdown sequence to the VM (and I could also use telnet to talk to it directly if I wanted).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .