Created
February 15, 2023 17:13
-
-
Save CodyMathis123/7d01e7547a845b5ba6cf7c7ac7f7662e to your computer and use it in GitHub Desktop.
Undecline ALL currently declined WSUS updates....
This file contains 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
$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