Created
January 22, 2018 14:01
-
-
Save thecliguy/419e62c82057129c707cbd5cc54c216a to your computer and use it in GitHub Desktop.
List Approved and Declines Updates
This file contains hidden or 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
# List approved and decline updates, including details such as the computer | |
# group(s) for which they have been approved/declined and the date/time on which | |
# the action was taken. | |
# NB: If an administrator has neither approve or declined an update then it is | |
# implcitly classified as 'NotApproved'. However, it would appear that the | |
# 'GetUpdateApprovals' method (used below) does NOT retrieve such updates. | |
$serverName = "TestServer" | |
$portnumber = 8530 | |
Add-Type -AssemblyName "Microsoft.UpdateServices.Administration, Version=3.1.6001.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35" | |
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($serverName,$false,$portnumber) | |
$UpdateScope = New-Object Microsoft.UpdateServices.Administration.UpdateScope | |
$UpdateScope.ApprovedStates="Any" | |
$Approvals = $wsus.GetUpdateApprovals($UpdateScope) | |
$Approvals | ` | |
Select-Object CreationDate, ` | |
AdministratorName, ` | |
@{n='UpdateId';e={ $_.UpdateId.UpdateId }}, ` | |
@{n='RevisionNumber';e={ $_.UpdateId.RevisionNumber }}, ` | |
@{n='KB';e={ ($wsus.GetUpdate([guid]" $($_.UpdateId.UpdateId)")).KnowledgeBaseArticles[0] }}, ` | |
@{n='Title';e={ ($wsus.GetUpdate([guid]" $($_.UpdateId.UpdateId)")).title }}, ` | |
Action, ` | |
@{n='ComputerTargetGroupName';e={ $ComputerTargetGroupId = $_.ComputerTargetGroupId; ($wsus.GetComputerTargetGroups() | Where {$_.Id -eq $ComputerTargetGroupId}).Name }} ` | |
| fl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment