Beans new with a WSUS server, working properly, but the more annoying is sometimes patch update more, the default one reboot not, but also have to reboot several times to complete all the installation. If you do not restart the installation in a timely manner, Windows 2012 will automatically restart after a day, and if it happens to be a working day, it will be dumbfounded.
How to solve it? The beans are going to write a script to automatically detect the restart status, and if necessary, send a restart command.
The script that detects the restart status is already available on the web and has been tried very well.
https://gallery.technet.microsoft.com/scriptcenter/Get-PendingReboot-Query-bdb79542
Once you have downloaded this script, you can implement my requirements with a little modification.
Simple test, create an array, put in my server name, dot source download script, inside the local variable becomes a global variable, so you can directly invoke the function of the script.
Then compare the status to restart the corresponding server.
[Email protected] ("Sydwsus", "melfs01", "sydit01"). C:\temp\get-pendingreboot.ps1$results=get-pendingreboot-computername $namesforeach ($c in $results) {if ($c. Rebootpending-eq "True") {restart-computer $c. Computer}}
In addition, if a server is found to be in a countdown restart state, but the condition does not allow you to restart, you can forcibly terminate the countdown by shutting down Windows Update processes and services.
This article is from the "Mapo Tofu" blog, please be sure to keep this source http://beanxyz.blog.51cto.com/5570417/1664082
Check for restart status after WSUS auto update