Use Get-WindowsUpdate or its alias Install-WindowsUpdate to find and manage available updates.
Common Tasks:
List available updates on the local machine:
Get-WindowsUpdate
Search remote machines with filters:
Search for updates on a remote computer (-ComputerName) using regular expressions on the title (-Title) and including Microsoft updates (-MicrosoftUpdate).
Get-WindowsUpdate -ComputerName MG-PC -MicrosoftUpdate -Title "Aktualizacja.*Windows 11" -Verbose
Hide specific updates:
To prevent specific updates from being installed, use the -KBArticleID and the -Hide flag.
Get-WindowsUpdate -KBArticleID KB4034658 -Hide -Verbose
# OR
Hide-WindowsUpdate -KBArticleID KB4034658 -Verbose
Schedule an installation job:
You can schedule an update installation at a specific time using -ScheduleJob. Combined with -AcceptAll and -AutoReboot, this allows for unattended maintenance.
Get-WindowsUpdate -MicrosoftUpdate -UpdateID ddb74579-7a1f-4d1f-80c8-e8647055314e -RevisionNumber 200 -ScheduleJob (Get-Date -Hour 18 -Minute 0 -Second 0) -Install -AcceptAll -AutoReboot -Verbose