PowerShell Patching Question - Query for "Schedule the Restart" value

Copper Contributor

After you install windows patches you can set a reboot for a future time under "Schedule the Restart" option. Is there a way to query this value? Registry perhaps? Google does not turn up much of anything in this regard.

 

Is there anyway to query or maybe even set this value using PowerShell?

2 Replies

@jake192

 

Hi Jake - The below 2 articles have scripts to check for the restart flag that is set in registry indicating a restart is required - which may also be useful here

https://4sysops.com/archives/use-powershell-to-test-if-a-windows-server-is-pending-a-reboot/ 

https://adamtheautomator.com/pending-reboot-registry/ 

 

This article contains the relevant registry keys involved in Windows Update

Manage device restarts after updates (Windows 10) - Windows Deployment | Microsoft Docs

the last key listed in the article is the one it sounds like you are after...

ScheduledInstallTimeREG_DWORD0-23: schedule update installation time to a specific hour
starts with 12 AM (0) and ends with 11 PM (23)

 

@SteveMacNZ 

 

Hey Steve, thanks for the response.

I thought the reg value you listed below: ScheduledInstallTime might be related to the "Schedule the Restart" option. However I scheduled the restart but did not see the value, it actually doesn't exist for me.

 

I went a step further and used Regshot to compare a before and after of the registry. Nothing of note shows up in the results.

 

I thought maybe a scheduled task or something gets logged in the event logs, no luck.

 

I will keep looking but running out of ideas, Microsoft is hiding this pretty well.