Windows – Cannot shutdown/reboot windows 7 when session is locked

windowswindows 7

I'm running a Windows 7 in a KVM virtual machine on my laptop.

When there is no user logged in or if I'm logged in but the session is not locked, I can ask Windows to shutdown or reboot directly from the host (ACPI signal?).

But when the session is locked, nothing is happening anymore.

This is quite annoying because if I forget to shutdown the VM (or unlock the session) before shutting down the host, the VM is just killed.

I'm looking for a way to make Windows behave the same way as when the session is unlocked. An idea?

Edit: It's Windows 7 enterprise and it's linked to an AD, but I'm never connecting to it.

Best Answer

As you discovered, when the session is locked Windows does not respond to ACPI events. However, you can shutdown the machine via WMI and other APIs.

As a side note, I did some testing on how Windows responds to ACPI shutdown event. You can find more here