Skip to content

Instantly share code, notes, and snippets.

@jjtroberts
Created December 5, 2023 18:47
Show Gist options
  • Save jjtroberts/40158e22e49af09cc1a8e5948a0ed680 to your computer and use it in GitHub Desktop.
Save jjtroberts/40158e22e49af09cc1a8e5948a0ed680 to your computer and use it in GitHub Desktop.
Powershell WSUS Test
# Install-WindowsFeature -Name UpdateServices-RSAT
[void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
$WSUSServer = 'WSUS'
# This is your WSUS Server Name
$Port = 8530
# This is 8531 when SSL is enabled
$UseSSL = $False
#This is $True when SSL is enabled
Try
{
$Wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer($WSUSServer,$UseSSL,$Port)
$Wsus.GetComputerStatus($computerscope,[ Microsoft.UpdateServices.Administration.UpdateSources]::All) | select ComputerTargetCount,ComputerTargetsNeedingUpdatesCount, ComputerTargetsWithUpdateErrorsCount, ComputersUpToDateCount
}
Catch
{
Write-Warning "$($WSUSServer)<$($Port)>: $($_)"
Break
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment