mgajda83 / PSWindowsUpdate

This module contain cmdlets to manage Windows Update Client.
MIT License
253 stars 24 forks source link

PSWindowsUpdate

PSGallery Version PSGallery Downloads PowerShell PSGallery Platform

This module contain cmdlets to manage Windows Update Client.

Table of Contents

Release Notes

v2.2.1

v2.2.0

v2.1.1

v2.1.0

v2.0.0

Install module from the PowerShell Gallery

Install-Module PSWindowsUpdate

Usage and Examples

Import the module:

Import-Module PSWindowsUpdate

Get-WindowsUpdate / Install-WindowsUpdate

Get windows updates available from default service manager.

Get-WindowsUpdate

Get all available update on remote machine MG-PC, that contains in Title this two words 'Aktualizacja' and 'Windows 11' (as regular expression).

Get-WindowsUpdate -ComputerName MG-PC -MicrosoftUpdate -Title "Aktualizacja.*Windows 11" -Verbose

Hide update with KBArticleID: KB4034658.

Get-WindowsUpdate -KBArticleID KB4034658 -Hide -Verbose

...or use alias

Hide-WindowsUpdate -KBArticleID KB4034658 -Verbose

Schedule job at 6:00 PM to install update with UpdateId='ddb74579-7a1f-4d1f-80c8-e8647055314e' and RevisionNumber=200. Update will be automaticaly accepted and after all server will be automaticaly restarted if needed.

Get-WindowsUpdate -MicrosoftUpdate -UpdateID ddb74579-7a1f-4d1f-80c8-e8647055314e -RevisionNumber 200 -ScheduleJob (Get-Date -Hour 18 -Minute 0 -Second 0) -Install -AcceptAll -AutoReboot -Verbose

...or use alias

Install-WindowsUpdate -MicrosoftUpdate -UpdateID ddb74579-7a1f-4d1f-80c8-e8647055314e -RevisionNumber 200 -ScheduleJob (Get-Date -Hour 18 -Minute 0 -Second 0) -AcceptAll -AutoReboot -Verbose

Add-WUServiceManager

Try register Microsoft Update service as Service Manager.

Add-WUServiceManager -MicrosoftUpdate

Try register Offline Sync Service from file C:\wsusscn2.cab.

Add-WUServiceManager -ScanFileLocation C:\wsusscn2.cab

Get-WUHistory

Get Windows Update history.

Get-WUHistory

Get Windows Update Agent history for last 24h.

Get-WUHistory -MaxDate (Get-Date).AddDays(-1)

Remove-WindowsUpdate

Try to uninstall update with specific KBArticleID = KB958830.

Get-WUUninstall -KBArticleID KB958830

Get-WUSettings / Set-WUSettings

Get current Windows Update Client configuration.

Get-WUSettings

Set the target version for feature updates to Windows 10 22H2.

Set-WUSettings -TargetReleaseVersion -TargetReleaseVersionInfo 22H2 -ProductVersion "Windows 10"

Support

I develop most of my code under open licenses, free of charge. If you are satisfied with these solutions, you can express your support for me. The greater your support, the greater the motivation to develop them further. The more motivation, the more things I can create.