Skip to content

Instantly share code, notes, and snippets.

@CodyMathis123
Created February 15, 2023 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CodyMathis123/7d01e7547a845b5ba6cf7c7ac7f7662e to your computer and use it in GitHub Desktop.
Save CodyMathis123/7d01e7547a845b5ba6cf7c7ac7f7662e to your computer and use it in GitHub Desktop.
Undecline ALL currently declined WSUS updates....
$wsus = Get-WsusServer
$scope = [Microsoft.UpdateServices.Administration.UpdateScope]::new()
$scope.ApprovedStates = [Microsoft.UpdateServices.Administration.ApprovedStates]::Declined
$updates = $wsus.GetUpdates($scope)
$AllComputersTargetGroup = $wsus.GetComputerTargetGroup([Microsoft.UpdateServices.Administration.ComputerTargetGroupId]::AllComputers)
foreach($computerGroup in $AllComputersTargetGroup.GetChildTargetGroups()){
foreach($update in $updates){
$update.Approve([Microsoft.UpdateServices.Administration.UpdateApprovalAction]::NotApproved, $computerGroup)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment