In my previous post, I showed you how to make a connection to a WSUS server, view clients reporting to the server and how to start and view the progress of a WSUS sync. In this post, I will show you how to view all of the updates on the server and look at the details of the updates.
Using the already made $wsus variable, you can take advantage of the GetUpdates() method to list out every single update that is available on the WSUS server to either approve or decline.
$wsus.GetUpdates()
You can get a lot of detailed information about each update such as the creation date, arrival date, kb article, installation/uninstallation behavior.
Listing the Installation Behavior of a patch:
$update = $wsus.GetUpdates() | Select -first 1 $update.InstallationBehavior
Listing the Uninstallation Behavior of a patch:
$update = $wsus.GetUpdates() | Select -first 1 $update.UninstallationBehavior
You can even generate a report of updates that have been approved using the IsApproved property.
Approved Patches:
$wsus.GetUpdates() | ? {$_.IsApproved -eq "True"} | Select Title,ProductTitles, KnowledgebaseArticles,` SecurityBulletins, CreationDate, ArrivalDate
Likewise, you can use the IsDeclined property to report all patches that have been declined.
$wsus.GetUpdates() | ? {$_.IsDeclined -eq "True"} | Select Title,ProductTitles, KnowledgebaseArticles,` SecurityBulletins, CreationDate, ArrivalDate
This snippet will report all patches that have been released in the past month:
$wsusserver = "wsusserver" [void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") $wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($wsusserver,$False) $wsus.GetUpdates() | ? {$_.CreationDate -gt (Get-Date).addMonths(-1)} | Select Title,ProductTitles,` KnowledgebaseArticles, SecurityBulletins, CreationDate, ArrivalDate
On a side note, if you ever wanted to know the descriptions for the various classifications for each update, such as Drivers, Critical Updates, Service Packs, etc… You can use this snippet to get the definitions:
$wsusserver = "wsusserver" [void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") $wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($wsusserver,$False) $wsus.GetUpdateClassifications() | FT Title, Description -wrap -auto
Not really earth-shattering, but still something interesting.
Hello, this awsome, but there as also list the release date, item and size?
really great advice on this page, one typo
Listing the Uninstallation Behavior of a patch:
$update = $wsus.GetUpdates() | Select -first 1
$update.InstallationBehavior
should be
$update = $wsus.GetUpdates() | Select -first 1
$update.unInstallationBehavior
Thanks for the comment and for finding the typo! It has been corrected.
I’ve been waiting for something like this for a very long time! Thank you so much for this awesome Module. Will save me a lot of time and, more importantly, a lot of SQL scripts!
Great series. Thank you for the post.
Pingback: Tweets that mention WSUS: Viewing Updates with PowerShell | Learn Powershell | Achieve More -- Topsy.com