Connect to WSUS server from PowerShell
At time while troubleshooting SUP (software update point)in SCCM we get error in WCM.log that we are unable to connect to WSUS server. Most of the time turning out to be proxy or a network issue,
This script will help you connect to the WSUS and let us know if the connection is successful or else will help us with the exception information. hence we could isolate the issue out of SCCM to understand if it is environment or a configuration issue in SCCM
Many a times I have found this handy
#Change server name and port number and $True if it is on SSL
[String]$updateServer1 = "CMCAS"[Boolean]$useSecureConnection = $False
[Int32]$portNumber =8530# Load .NET assembly
[void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
# Connect to WSUS Server
$updateServer = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($updateServer1,$useSecureConnection,$portNumber)
write-host "<<<Connected sucessfully >>>" -foregroundcolor "yellow"
trap
{
write-host "Error Occurred"
write-host "Exception Message: "
write-host $_.Exception.Message
write-host $_.Exception.StackTrace
exit
}
# EOF
On success you would get this
Or error exception
This posting /Script is provided "AS IS" with no warranties and confers no rights
Comments
- Anonymous
February 28, 2015
Thanks - Anonymous
May 11, 2015
The comment has been removed