View Single Post
Old 10-03-2008   #5 (permalink)
jmedd
Guest


 
 

Re: Powershell, WSUS, Execute Multiple Approvals per client comput

OK cool. So those are the methods to make the approvals happen.

Are you able to help me put it all together like in the previous post?

"Shay Levy [MVP]" wrote:
Quote:

> Take II:
>
>
>
> $updateServer = "serverName"
> $wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($updateServer,$false)
>
> $updateScope = new-object Microsoft.UpdateServices.Administration.UpdateScope
> $updateScope.updateApprovalActions = "Install,Uninstall"
>
> $updates = $wsus.getUpdates($updateScope)
>
>
> $updates[0] | gm -MemberType method a*
>
> TypeName: Microsoft.UpdateServices.Internal.BaseApi.Update
>
> Name MemberType Definition
> ---- ---------- ----------
> ....
> Approve Method Microsoft.UpdateServices.Administra...
> ....
>
>
>
>
> Notice that the Approve() method has two overloads:
>
> Approve(UpdateApprovalAction action, IComputerTargetGroup targetGroup),
> Approve(UpdateApprovalAction action, IComputerTargetGroup targetGroup, DateTime
> deadline)}
>
>
>
>
> ---
> Shay Levy
> Windows PowerShell MVP
> http://blogs.microsoft.co.il/blogs/ScriptFanatic
> PowerShell Toolbar: http://tinyurl.com/PSToolbar
>
>
> j> I need to approve around 100 updates for a client computer in WSUS.
> j> Using the WSUS console for this is impracticle since its involves
> j> about 5 - 6 clicks per update, so naturally I am looking to
> j> Powershell for a solution.
> j>
> j> There are some sample scripts for managing WSUS 3.0 at the script
> j> center.
> j>
> j> http://www.microsoft.com/technet/scr...us/server/defa
> j> ult.mspx?mfr=true
> j>
> j> Basically what I need to do is for a particular computer find which
> j> updates need approving and then approve them all for a particular
> j> WSUS computer group in one go.
> j>
> j> So far I have:
> j>
> j> [reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.
> j> Administration") | out-null
> j> if (!$wsus) {
> j> $wsus =
> j> [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer
> j> ();
> j> }
> j>
> j> $wsus.GetComputerTargets()
> j>
> j> This basically returns a lot of info about the computers, but nothing
> j> to do with approvals.
> j>
> j> Similarly the following gives you a load of info about the updates
> j> including whether they are approved or not, but does not tell you
> j> which group they are approved for.
> j>
> j> [reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.
> j> Administration") | out-null
> j> if (!$wsus) {
> j> $wsus =
> j> [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer
> j> ();
> j> }
> j>
> j> $updateScope = new-object
> j> Microsoft.UpdateServices.Administration.UpdateScope;
> j> $updateScope.UpdateApprovalActions =
> j> [Microsoft.UpdateServices.Administration.UpdateApprovalActions]::Inst
> j> all `
> j> -bor
> j> [Microsoft.UpdateServices.Administration.UpdateApprovalActions]::Unin
> j> stall
> j> $wsus.GetUpdates($updateScope)
> j>
> j> Exchanging the last line for
> j>
> j> $wsus.GetUpdateApprovals($updateScope)
> j>
> j> gets you some approval info, but not quite what I'm looking for.
> j>
> j> Anyone willing to assist would be most appreciated.
> j>
>
>
>
>
My System SpecsSystem Spec