Is my server pending reboot?

Copper Contributor

I wonder if anyone has any ideas on finding, using powershell, if a server is planning on rebooting anytime soon?

I can find out if a reboot is due for windows updates and a few other possible reasons, using powershell but if a reboot is waiting from running shutdown -r -t nnnnn then none of the places I know to look are helpful. Even Windows Admin Centre does not seem to know the server has a reboot pending. I have looked in Event viewer for a system log event ID13 but that may or may not tell me anything about an upcoming reboot.

A shutdown -a knows if a reboot is pending or not (it errors if not) but I can't find out where to look to find this information myself.

Any Ideas please?

4 Replies
best response confirmed by Peter_BW (Copper Contributor)

@Dave Patrick Thanks that does help - I was using get get-eventlog to try and look at event ID13 and that was really not helpful.

Get-WinEvent is much more useful and actually returns the date and time of the scheduled reboot, and the reason. 

Many thanks for that

Glad to hear it helps. Please don't forget to mark helpful replies.




So, for anyone else having this problem:

I could find nothing in registry that helped specifically for shutdown.exe

This identified some reboot reasons I did not know about so I used this rather than my original code.

I then looked at the last event log entry for 1074

Get-WinEvent -ComputerName $computername -FilterHashtable @{logname = 'System'; id = 1074} -MaxEvents 1

by comparing the TimeCreated property of that result with the last boot time of the computer I could see if the event was historical or planned.

If planned, I then compared the TimeCreated property of event 1074 with 1075 to see it a shutdown -a had been used to cancel the reboot.


1 best response

Accepted Solutions
best response confirmed by Peter_BW (Copper Contributor)