Created
November 9, 2015 16:03
-
-
Save Grimthorr/44727ea8cf5d3df11cf7 to your computer and use it in GitHub Desktop.
PowerShell script to list the pending/missing Windows updates.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$UpdateSession = New-Object -ComObject Microsoft.Update.Session | |
$UpdateSearcher = $UpdateSession.CreateupdateSearcher() | |
$Updates = @($UpdateSearcher.Search("IsHidden=0 and IsInstalled=0").Updates) | |
$Updates | Select-Object Title |
Hello
This script shows optional updates as well
Is there any way to exclude optional updates?
I tried using $Updates = @($UpdateSearcher.Search("IsMandatory=0").Updates)
but it throws OperationStopped: 0x80240032
error.
Thanks in advance.
You can find it like that:
$UpdateSession = New-Object -ComObject Microsoft.Update.Session
$UpdateSearcher = $UpdateSession.CreateupdateSearcher()
$Updates = @($UpdateSearcher.Search("IsHidden=0 and IsInstalled=0").Updates)
$Updates | Where-Object IsMandatory -eq $true | Select Title, IsMandatory
Thanks
Thanks @fliespl! ❤️
This appears to be actually skipping optional/recommended updates. I have update preview kb5011831 pending in WU on W10LTSC 21H2 19044.1348 but it is not in the list generated by UpdateSearcher
. I've tried supplying empty criteria - still the same result. It does ignore the group policy for "skip drivers in WU" which is nice.
If u need to read from a software like Zabbix or just load in some api or application you can use this
Thanks, this was perfect!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great this script really helps.