tip on how to prompt for restart when using get-pendingreboot

I have been using the get-pendingreboot option for a while, before it was incorporated in the main script I used it as an extension using a script from Microsoft.

Works well too and gives users 8 hours before it reboots:

If($IsSystemRebootPending -eq $True){
Show-InstallationRestartPrompt -CountdownSeconds 28805 -CountdownNoHideSeconds 60
Exit-Script -ExitCode 1618

You could either simply add this to your deploy scripts or at the end of the get-pendingreboot function (what I have been doing).


But it will not work with SCCM as Show-InstallationRestartPrompt will not show up while deploying with System account (session 0).


Hi guys,

I’m unable to get this code to work on Windows 7 (powershell version 2.0). The IsSystemRebootPending value is true but is not prompting to restart with your code?

I intend to deploy to a targeted collection in ConfigMgr, although the script is not manually working.

Any help would be great