Created
December 5, 2023 18:47
-
-
Save jjtroberts/40158e22e49af09cc1a8e5948a0ed680 to your computer and use it in GitHub Desktop.
Powershell WSUS Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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