View Single Post
Old 10-01-2008   #1 (permalink)
jmedd
Guest


 
 

Powershell, WSUS, Execute Multiple Approvals per client computer

I need to approve around 100 updates for a client computer in WSUS. Using the
WSUS console for this is impracticle since its involves about 5 - 6 clicks
per update, so naturally I am looking to Powershell for a solution.

There are some sample scripts for managing WSUS 3.0 at the script center.

http://www.microsoft.com/technet/scr....mspx?mfr=true

Basically what I need to do is for a particular computer find which updates
need approving and then approve them all for a particular WSUS computer group
in one go.

So far I have:

[reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") | out-null
if (!$wsus) {
$wsus =
[Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer();
}


$wsus.GetComputerTargets()


This basically returns a lot of info about the computers, but nothing to do
with approvals.

Similarly the following gives you a load of info about the updates including
whether they are approved or not, but does not tell you which group they are
approved for.

[reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") | out-null
if (!$wsus) {
$wsus =
[Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer();
}

$updateScope = new-object Microsoft.UpdateServices.Administration.UpdateScope;
$updateScope.UpdateApprovalActions =
[Microsoft.UpdateServices.Administration.UpdateApprovalActions]::Install `
-bor
[Microsoft.UpdateServices.Administration.UpdateApprovalActions]::Uninstall

$wsus.GetUpdates($updateScope)


Exchanging the last line for

$wsus.GetUpdateApprovals($updateScope)

gets you some approval info, but not quite what I'm looking for.

Anyone willing to assist would be most appreciated.
My System SpecsSystem Spec