Repository navigation
Conversation
Previously the -WSUS switch passed -WindowsUpdate to Get-WindowsUpdate, which forces the online Windows Update service ID (9482F4B4...) and bypasses WSUS filtering entirely, returning all Microsoft-hosted updates regardless of what WSUS has approved. Fix: when -WSUS is specified, call Get-WindowsUpdate with no service flag so the Windows Update Agent routes through the WSUS server configured by Group Policy. When -WSUS is not specified, use -MicrosoftUpdate to query Microsoft's catalog directly and return every available update. Closes pdqcom#109
-WSUS now passes the WSUS service ID, which is the fix the reporter confirmed in pdqcom#109. Scans without -WSUS go back to no service flag. -MicrosoftUpdate made WSUS-managed computers bypass WSUS for anyone not using the parameter, which pdqcom#109 did not ask for.
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-WSUSreturning updates that aren't approved in WSUS-WSUSnow queries the WSUS service by ID, which is the fix the reporter confirmed in Get Available Windows Updates scanner not pulling from WSUS #109-WSUSis unchangedRoot cause
The script called
Get-WindowsUpdate -WindowsUpdatewhen-WSUSwas specified.-WindowsUpdateselects Microsoft's online Windows Update service, so results ignored WSUS approvals.Change
If ($WSUS) { - $GWU = Get-WindowsUpdate -WindowsUpdate + $GWU = Get-WindowsUpdate -ServiceID '3da21691-e39d-4da6-8a4b-b43877bcb1b7' }The README now says the target must be configured to use a WSUS server, and that without
-WSUSthe scanner uses whichever update service the target is configured to use.Testing
Tested on Windows PowerShell 5.1 and PowerShell 7 with
Get-WindowsUpdatestubbed, confirming which arguments each path passes. That doesn't exercise a real WSUS server. The service ID comes from the reporter's comment on #109, where they confirmed it worked in their environment.-WSUSon a machine pointing to a WSUS server and confirm only approved updates are returned-WSUSand confirm the results match the previous behavior-WSUSon a machine not using WSUS and check how the failure appears in the scan resultsCloses #109