I'm trying to weed out and decline itanium updates from my WSUS server to save space.
I found a technet page that gave me an almost ready to go script (just change environment variables). Link [Microsoft Technet]
The idea of the script is to decline all Itanium/IA64 updates and send an email stating what it has declined.
I have made the environment changes to the script and I receive the same two errors but I have no idea what they mean or how to resolve them.
Errors:
Exception calling "GetUpdateServer" with "3" argument(s): "The type initializer for 'Microsoft.UpdateServices.Internal.Constants' threw an exception."
At
You cannot call a method on a null-valued expression.
At
Here is the code from the Technet link link (above).
$WsusServer = "" $UseSSL = $false $PortNumber = $TrialRun = $true #E-mail Configuration $SMTPServer = " " $Recipients = " " $MessageSubject = "WSUS :: Declining Itanium Updates" Function SendEmailStatus($MessageSubject, $MessageBody) { $SMTPMessage = New-Object System.Net.Mail.MailMessage $FromAddress, $Recipients, $MessageSubject, $MessageBody $SMTPMessage.IsBodyHTML = $true #Send the message via the local SMTP Server $SMTPClient = New-Object System.Net.Mail.SMTPClient $SMTPServer $SMTPClient.Send($SMTPMessage) $SMTPMessage.Dispose() rv SMTPClient rv SMTPMessage } #Connect to the WSUS 3.0 interface. [reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") | out-null $WsusServerAdminProxy = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer($WsusServer,$UseSSL,$PortNumber); #$itanium = $WsusServerAdminProxy.SearchUpdates('Itanium') | ?{-not $_.IsDeclined} #$itanium += $WsusServerAdminProxy.SearchUpdates('ia64') | ?{-not $_.IsDeclined} #Although the above seems faster it also seaches in the description of the update so use the below just to search the title! $itanium = $WsusServerAdminProxy.GetUpdates() | ?{-not $_.IsDeclined -and $_.Title -match “ia64|itanium”} If ($TrialRun) {$MessageSubject += " Trial Run"} Else {$itanium | %{$_.Decline()}} $Style = "" If ($itanium.Count -gt 0){ $MessageBody = $itanium | Select ` @{Name="Title";Expression={[string]$_.Title}},` @{Name="KB Article";Expression={[string]::join(' | ',$_.KnowledgebaseArticles)}},` @{Name="Classification";Expression={[string]$_.UpdateClassificationTitle}},` @{Name="Product Title";Expression={[string]::join(' | ',$_.ProductTitles)}},` @{Name="Product Family";Expression={[string]::join(' | ',$_.ProductFamilyTitles)}},` @{Name="Uninstallation Supported";Expression={[string]$_.UninstallationBehavior.IsSupported}} | ConvertTo-HTML -head $Style SendEmailStatus $MessageSubject $MessageBody }
I am using WSUS 3.0 on Server 2008 R2 Enterprise.
I am NOT using PoshWSUS.