How Can I Set a Windows Machine as 'Pending Reboot' with PowerShell?
Asked by
!spot the difference
Hey everyone! I'm looking for a way to use PowerShell to mark a Windows machine as 'Pending Reboot'. While I've found methods to check if a reboot is needed or to just reboot the machine itself, what I really want is a method to tag a machine and notify the user that a reboot is required. This would be super handy for running scripts behind the scenes, so we can set a machine as 'reboot needed' when appropriate. Any advice would be greatly appreciated! Thanks!
Answers
There are several registry keys that signify when a reboot is pending. One to look at is: HKLM:SOFTWAREMicrosoftWindowsCurrentVersionWindowsUpdateAuto UpdateRebootRequired. This can help you identify if a reboot is in the wings.
Reply to this answer
For toast notifications to inform users about reboot needs, check out the link I shared! It has a neat snippet using Windows native and .NET APIs. Also, some software like Dell Command Update may set their own reboot keys, so keep that in mind when using SCCM. You can get extra ideas there too!
Reply to this answer
I should mention that in my experience with Exchange installations, setting the reg key 'HKEY_LOCAL_MACHINESOFTWAREMicrosoftUpdatesUpdateExeVolatile' to "0" solved some pending reboot issues. You may want to check if you can set this value to "1" using PowerShell, but be cautious, as Iโm not sure if it will switch back to "0" after a reboot.
Reply to this answer
Just a heads up, I donโt think you can set a machine into a 'pending reboot' state the way youโre thinking. You could either prompt users properly or take control and force a reboot if needed.
Reply to this answer
Just so you know, thereโs a difference between a 'pending reboot' state in the registry and the GUI prompt that users see after updates. You can manipulate the registry keys, but achieving the GUI prompt might be a different story entirely.
Reply to this answer
Add your answer
Answers are reviewed before publication.
slate.roof: That's useful info! If you want to ensure it remains effective, testing it on a non-critical machine first could help.