Connection to WSUS from Powershell issue.
Incercand sa ma conectez la un WSUS din Powershell folosind codul de mai jos:
$wsusserver = ‘localhost’
#Load required assemblies
[void][reflection.assembly]::LoadWithPartialName(“Microsoft.UpdateServices.Administration”)
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($wsusserver,$False)
Am dat de urmatoarea eroare:
Exception calling “GetUpdateServer” with “2” argument(s): “The request failed with HTTP status 404: Not Found.”
At C:\Documents and Settings\Administrator.VMUG\Desktop\wsus.ps1:4 char:78
+ $wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer <<<< ($wsusserver,$False)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
Problema era ca WSUS-ul meu e pe portul 8530 si asta trebuie specificat in script:
$wsusserver = ‘localhost’
[Int32]$portNumber = 8530
#Load required assemblies
[void][reflection.assembly]::LoadWithPartialName(“Microsoft.UpdateServices.Administration”)
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($wsusserver,$False,$portNumber)