Windows server power off button and blocked sessions

318 views Asked by At

We have one windows Server 2008 R2 installation and we need the power button to trigger the server's shutdown procedure.

Generally this works as expected, but when there's a blocked session the shutdown does not happen.

I have googled this requirement wide and far, but I have been unable to find anything related.

1

There are 1 answers

0
manlio On BEST ANSWER

You could use the Windows Task Scheduler to create a task triggered by the power button event (I'm not sure about the EventID, perhaps 109 or 1074).

The task will call the shutdown command:

shutdown /s /d p:0:0
  • /s shutdown command to the local computer
  • /d this records the reason for the shut down (p is planned and 0:0 indicates an "Other" reason)