Home > Uncategorized > Apply auto-approval rules to new classifications in WSUS

Apply auto-approval rules to new classifications in WSUS

Okay, so not exactly what I said above, but you can use Powershell to approve updates that match some classification, OS, and/or product matching your auto-approval rules (although you will have to know your auto-approval rules).

You can use where-object to specify which Microsoft.UpdateServices.Commands.WsusUpdate objects to pipe into `approve-wsus` as follows.

This makes approving all updates for newly selected products or OSes much easier than going through the GUI and manually approving each for Install.

Here is an example of approving all updates for Windows 2012:

import-module updateservices
Get-WsusUpdate -Classification Critical -Approval Unapproved -Status FailedOrNeeded | where {$_.products -like "*2012*"} | approve-wsusupdate -action install -targetgroupname "All Computers" -whatif
Get-WsusUpdate -Classification Security -Approval Unapproved -Status FailedOrNeeded | where {$_.products -like "*2012*"} | approve-wsusupdate -action install -targetgroupname "All Computers" -whatif
Get-WsusUpdate -Classification all -Approval Unapproved -Status FailedOrNeeded | where {$_.products -like "*2012*" -and $_.classification -like "Updates"} | approve-wsusupdate -action install -targetgroupname "Servers" -whatif

Can’t find much in the way of the Microsoft.UpdateServices.Commands.WsusUpdate class, so here are the available fields to filter on (using -like or -contains as per the type definition):

Approved                           Property   string Approved {get;}
Classification                     Property   string Classification {get;}
ComputersInstalledOrNotApplicable  Property   int ComputersInstalledOrNotApplicable {get;}
ComputersNeedingThisUpdate         Property   int ComputersNeedingThisUpdate {get;}
ComputersWithErrors                Property   int ComputersWithErrors {get;}
ComputersWithNoStatus              Property   int ComputersWithNoStatus {get;}
InstalledOrNotApplicablePercentage Property   int InstalledOrNotApplicablePercentage {get;}
LanguagesSupported                 Property   System.Collections.Specialized.StringCollection LanguagesSupported {get;}
LicenseAgreement                   Property   string LicenseAgreement {get;}
MsrcNumbers                        Property   System.Collections.Specialized.StringCollection MsrcNumbers {get;}
MustBeInstalledExclusively         Property   bool MustBeInstalledExclusively {get;}
Products                           Property   System.Collections.Specialized.StringCollection Products {get;}
Removable                          Property   bool Removable {get;}
RestartBehavior                    Property   string RestartBehavior {get;}
Update                             Property   Microsoft.UpdateServices.Administration.IUpdate Update {get;}
UpdateId                           Property   string UpdateId {get;}
UpdatesSupersededByThisUpdate      Property   System.Collections.Specialized.StringCollection UpdatesSupersededByThi...
UpdatesSupersedingThisUpdate       Property   System.Collections.Specialized.StringCollection UpdatesSupersedingThis...
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: