The Windows Servers in our environment (2008 R2 and 2012 R2) install updates automatically once a month, but don't restart automatically (yet), because the WSUS server should be the last server to restart and not all domain controllers should restart at the same time.
How can I setup a system where each server reports to a server when it finished installing all updates? I'd like to write a script that gets the update status of a server and then decides if the server is allowed to reboot.
Also, I miss (WSUS/Windows) update notifications in general, for example if an update fails, I'd like to get a notification and not having to check each server manually.
Best Answer
On TechNet a lot of script exist for that, to query for the reboot required. There is one from a MSFT's employee. You can add the Restart-Computer cmdlet in the script as needed to fit your need.
See that blog post, that explain the script. Determine Pending Reboot Status—PowerShell Style! Part 1 Determine Pending Reboot Status—PowerShell Style! Part 2
Link to the script. Get-PendingReboot - Query Computer(s) For Pending Reboot State