proxb / PoshWSUS

PowerShell module to manage Windows Server Update Services (WSUS)
MIT License
231 stars 64 forks source link

Get-PSWSUSConfigSyncUpdateClassifications.ps1 incorrectly throws warning #28

Open BenPenney opened 8 years ago

BenPenney commented 8 years ago

The Get-PSWSUSConfigSyncUpdateClassifications command gives me the warning that i need to connect to WSUS every time. Looking at the code it looks incorrect compared to other commands in the set.

Here is the working part of Get-PSWSUSConfigSyncUpdateClassifications.ps1.

if ($wsus)
{
     Write-Warning "Use Connect-PSWSUSServer for establish connection with your Windows Update Server"
     Break
}
$wsus.GetSubscription().GetUpdateClassifications()

I think it should look more like this,

if ($wsus)
{
     $wsus.GetSubscription().GetUpdateClassifications()
}
Else
{
     Write-Warning "Use Connect-PSWSUSServer for establish connection with your Windows Update Server"
     Break
}

As a work around I am using the following code instead of this command, $wsus = connect-psWsusServer "localhost" $wsus.GetSubscription().GetUpdateClassifications()

BenPenney commented 8 years ago

Forgot I can just change the commands locally myself. The code I suggested seems to work for me.