Hello there, I seem to be having some trouble with scripting a way to check windows updates quickly. First of all, I have pretty much tried every script on the exchange and for some reason or another, it is not what I want.
I'm basically just need a script that checks the number of critical updates available and compare and it warning and critical values. The problem is every script that I have tried that works is very very very slow.
Most of the powershell scripts on the exchange that I've tried use something along the lines of
"$UpdateSession = New-Object -ComObject Microsoft.Update.Session
$UpdateSearcher = $UpdateSession.CreateUpdateSearcher()
$SearchResult = $UpdateSearcher.Search("IsHidden=0 and IsInstalled=0")
#Matrix Results for type of updates that are needed
$Critical = $SearchResult.updates | where { $_.MsrcSeverity -eq "Critical" }
"
Calling microsoft.update.session is really slow on the servers I need monitored, each check takes over 15 minutes.
The only other method I've seen to query updates is to look in either
C:\Windows\WindowsUpdates.log
or
C:\Windows\SoftwareDistribution\ReportingEvents.log
and although they both have information of pending updates (retrieved from previous update query), there is no way to distinguish how many updates are actually critical .
If any of you have any feedback, it would be greatly appreciated.
Quick way to monitor Windows Updates
-
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: Quick way to monitor Windows Updates
How long does it take if you click "Check for updates" on your test boxes? This is no doubt what the checks you've tried are doing in the background and I've seen this take HOURS on some versions of Windows.
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Quick way to monitor Windows Updates
I suggest using NSCA in NSClient++ to send passive check results for the Windows Updates check.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.