############################################################### # # Scriptname: Approve-NeededUpdates.ps1 # # Autor: Urs Heeb # Date: 16.08.2023 # # Version: 2023.08.01 / 16.08.23 / Urs Heeb # Create script # # # Description: Script does following: # Checks all updates which are not approved # If an update has the status failed or needed, # it will be approved for the defined target groups # # Requirements: # Has to run on the WSUS itself # Service user needs WSUS admin permissions # ############################################################### # Define target groups (comma separated) $UpdateTargets = @("Group1","Group2") # Get all unapproved but needed updates $NeededUpdates = Get-WsusUpdate -Approval Unapproved -Status FailedOrNeeded # Approve found updates for defined target groups ForEach ($Update in $NeededUpdates) { ForEach ($Target in $UpdateTargets) { Approve-WsusUpdate -Update $Update -Action Install -TargetGroupName $Target } }