Is there a way to find out if a Windows Server (2003, 2008) has downloaded the Microsoft Windows updates and is just waiting for the user to confirm "Install Updates and Restart the server"?
We use WSUS and SSCM to collect and publish the updates, and the majority of the servers are on automatic install on a Sunday morning, mostly development and test server.
We have setup our important production servers to only install manually, but occastionally some servers are not rebooted manually for a while (humans forget!)
It would be nice if there was some method (powershell script, WMI query, some magic command) that I could use to count or discover if there where updates pending.
Here is the script I wrote. It will tell you:
Example usage:
C:\> cscript ServerPendingUpdates.vbs myserver01 myserver02
Script:
you can use wuinstall. It has a /search switch to see if there are updates pending. You can execute remotely with psexec.
Another option is to parse the %windir%\windowsupdate.log and look for stuff like this: # WARNING: Install call completed, reboot required = Yes, error = 0x00000000
I use the UpdateHf.vbs script authored by Rob Dunn & contributors. Because it runs locally on the host it is reporting on, I have it installed on all my machines. I created an MSI package and pushed it via GPO.
To trigger the reporting, I have a collection of powershell scripts that create scheduled tasks on an OU worth of servers, where each machine is scheduled to run UpdateHF.vbs locally and email me the results. I then use sorting rules to colorcode the resulting emails based on searching for distinctive text in the report.
UpdateHF.vbs is basically a wrapper around Microsoft's published Automatic Updates API, so with some digging I bet you could figure out which bit of script handles the "Reboot Pending" check, if all you wanted was a boolean reboot-status flag.
Here's the core of my system: Powershell fills in the variables on a call to schtasks.exe. (Note that if the password has complex characters, you need to escape them with a backtick.)
As an admin of the remote box, open an MMC and then add the Event Viewer Snapin. Select "Another Computer" (versus the default of "Local Computer" and input the target computer name. Then filter by event type to see only the ones you want! It's called "Windows Update Agent" and the description will begin with
In 2012 R2 server go to control Panel, click on Windows Updates. On the left panel of the page click on "Check for updates" link, you will get to see the list of pending updates (yet to be installed on the server). Click on any of the link you will get to see the entire (both optional and mandatory) list with the brief description for each of them.
Please note for this Auto install for updates must be turned ON.