9

I need some Windows 2012 servers to be shutdown properly with the power button.

  • If nobody is logged, the power button correctly shuts down the server
  • If somebody is logged without a blocking program, it's okay too

But:

  • if a session is locked, the power button does nothing
  • if somebody is logged with a blocking program (notepad with an unsaved document for example), the button does nothing too

With previous Windows versions I was used to configure the power button behaviour with the GUI and modify a registry key (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system\shutdownwithoutlogon) but this seems not any more relevant.

Does anyone knows the "offical" way, or a trick ?

Edit:
The system log display an event each time I press the power button. The kernel power manager has initiated a shutdown transition with event ID 109.
When the session is locked, this event is followed by nothing. And no other events in other logs.
When a program refuse to close, I have the corresponding log entry, so this will be okay soon.

  • 2
    Show those damn smart switches who's really smart: yank the F^&%#ing power cord out of the wall! – Ward Sep 4 '13 at 23:19
5
+200

The fact you can't power down a 2012 server when a session is locked is probably by design. I faced a similar need and don't know any policy or registry change to allow that.

I used a simple trick: I captured the power button event which simply run my favorite shutdown.exe with the desired parameters after a timeout.
If you use the correct shutdown parameters, you won't be blocked by open programs.

To capture events, just open the task scheduler and create a task triggered on the desired event ID.

  • 3
    For reference, the command I use is: shutdown /s /t 10 /d p:0:0 – Gregory MOUSSAT Sep 6 '13 at 20:30
  • 4
    Also for reference the event in my case is a basic event with these properties Log: System, Source: Kernel-Power, Event-ID: 109 – ndemou Jun 30 '15 at 16:28
1

Check out AutoEndTasks:

You can set it for all users by creating the key here vs HKCU: HKEY_USERS.DEFAULT\Control Panel\Desktop

Additionally, there is some tuning that can be done via group policy that can be found here: Computer Configuration>Administrative Templates>System>Shutdown Options> Turn off automatic termination of applications that block or cancel shutdown

Additional tuning options that you may want to look into are: WaitToKillServiceTimeout,WaitToKillAppTimeout,HungAppTimeOut

I'll also second what MarcoZink stated, check your Bios and verify there isn't any special setting configured for your power button that may be holding things up.

  • 1
    I would not second what MarcoZink stated about the BIOS because the question clearly states "If nobody is logged, the power button correctly shuts down the server" – ndemou Jul 10 '15 at 8:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.