View Single Post
Old 10-02-2008   #3 (permalink)
jmedd
Guest


 
 

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

Awesome, that is taking it a lot further than I was getting. Thanks so much.

The further steps I need to take it are:

1) Be able to specify a particular client machine
2) Find only updates which are not approved for that machine
3) Approve all the updates which are approved for that machine specifying a
particular computer target group for the approval.

If I can get that, it will save me hours, maybe days of work!

Thanks
Jonathan

"Shay Levy [MVP]" wrote:
Quote:

> Hello jmedd,
>
>
> I was able to run this and get results:
>
>
>
> [void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
>
>
> $updateServer = "updateServerName"
> $wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($updateServer,$false)
>
> $computerScope = new-object Microsoft.UpdateServices.Administration.ComputerTargetScope
> $computerScope.includedInstallationStates = "Installed,NotInstalled"
>
> $updateScope = new-object Microsoft.UpdateServices.Administration.UpdateScope
> $updateScope.includedInstallationStates = "Installed,NotInstalled"
>
>
> $wsus.getComputerTargets($ComputerScope) | foreach {
>
> $machine = $_
> $fdn = @{n="FullDomainName";e={$machine.fullDomainName}}
>
> $_.getUpdateInstallationInfoPerUpdate($updateScope) | foreach {
> $updateId = $wsus.getUpdate($_.updateId)
> $updateId | select $fdn,Title,UpdateType,IsApproved,IsDeclined,KnowledgebaseArticles
> }
> }
>
>
>
> Here's the first item output:
>
> FullDomainName : serverName.domain
> Title : Cumulative Security Update for Outlook Express for
> Windows Server 2003 (KB929123)
> UpdateType : Software
> IsApproved : True
> IsDeclined : False
> KnowledgebaseArticles : {929123}
>
>
>
> HTH
>
> ---
> 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