WSUS – approving multiple updates for a specific computer

Very useful script:

Get-ComputerTargetGroups.ps1
[void][reflection.assembly]::LoadWithPartialName(Microsoft.UpdateServices.Administration)
$updateServer = WSUSServername
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($updateServer,$false)

$wsus.GetComputerTargetGroups()

ApproveMultipleUpdates.ps1
[void][reflection.assembly]::LoadWithPartialName(Microsoft.UpdateServices.Administration)
$updateServer = WSUSServername
$machineName = Read-Host Please enter the full DNS name of the computer you wish to approve updates for

$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($updateServer,$false)
$updateScope = new-object Microsoft.UpdateServices.Administration.UpdateScope
$updateScope.includedInstallationStates = NotInstalled
$com = $wsus.GetComputerTargetByName($machineName)

$groupid= Read-Host Please enter the Computer Group Target ID

$group = $wsus.GetComputerTargetGroup($groupid)
$action = [Microsoft.UpdateServices.Administration.UpdateApprovalAction]::Install

$updates = $com.GetUpdateInstallationInfoPerUpdate($updateScope)
$updates | foreach-object {$uid = $_.UpdateId; $u = $wsus.GetUpdate($uid); $u.Title; $u.Approve($action,$group);}



original post here:
http://www.jonathanmedd.net/2008/11/wsus-30-approving-multiple-updates-for-a-specific-computer-with-powershell.html

Leave a Reply

Your email address will not be published. Required fields are marked *

5 × 1 =

This site uses Akismet to reduce spam. Learn how your comment data is processed.