`PSWindowsUpdate
` module is a PowerShell module that provides cmdlets to manage Windows updates. It is not available as default in Windows, but it can be available for free from the PowerShell Gallery.
The PSWindowsUpdates module can be used to do the following:
- Check for available Updates
- Install Windows Updates
- Remove Windows Updates
- Hide Updates
- View Update History
- List Available Updates
In this article, we will discuss how to use the PSWindowsUpdate module for managing Windows updates.
How to Install PSWindowsUpdate Module in Windows
To install the PSWindowsUpdate
module in Windows, run the following command in PowerShell.
Install-Module PSWindowsUpdate
In the above PowerShell script, the Install-Module
command installs the PSWindowsUpdate
module.
The output of the above PowerShell script that installs the PSWindowsUpdate
module is given below.
Once the module is installed, you can use the following command to get information about PSWindowsUpdate.
Get-Commmand -module PSWindowsUpdate
This PowerShell command returns the list of cmdlets available in the PSWindowsUpdate
module.
The output of the above command displays a list of all the cmdlets.
Let’s understand the brief description of the module commands.
- Clear-WUJob: Clear a Windows Update job from Task Scheduler.
- Download-WindowsUpdate: Download available Windows updates.
- Get-WUInstall: Get information about pending Windows updates for installation.
- Get-WUList: Display a list of available Windows updates.
- Hide-WindowsUpdate: Hide a specific Windows update.
- Install-WindowsUpdate: Install pending Windows updates.
- Show-WindowsUpdate: Display hidden Windows updates.
- UnHide-WindowsUpdate: Unhide a previously hidden Windows update.
- Uninstall-WindowsUpdate: Uninstall a specific Windows update.
- Add-WUServiceManager: Register the Windows Update Service Manager.
- Enable-WURemoting: Enable Windows Defender firewall rules for remote PSWindowsUpdate usage.
- Get-WindowsUpdate: Get a list of available Windows updates and manage their installation.
- Get-WUApiVersion: Retrieve the Windows Update Agent version.
- Get-WUHistory: Display the history of installed updates.
- Get-WUInstallerStatus: Check the Windows Installer service status.
- Get-WUJob: Check for Windows Update job tasks in Task Scheduler.
- Get-WULastResults: Get the last search and installation results.
- Get-WUOfflineMSU: Retrieve offline MSU file information.
- Get-WURebootStatus: Check if a system reboot is required for updates.
- Get-WUServiceManager: List available update sources.
- Get-WUSettings: Retrieve Windows Update client settings.
- Invoke-WUJob: Remotely execute PSWindowsUpdate tasks.
- Remove-WindowsUpdate: Remove a specific Windows update.
- Remove-WUServiceManager: Disable the Windows Update Service Manager.
- Reset-WUComponents: Reset the Windows Update agent to its default state.
- Set-PSWUSettings: Save PSWindowsUpdate module settings to an XML file.
- Set-WUSettings: Configure Windows Update client settings.
- Update-WUModule: Update the PSWindowsUpdate module.
How to Check for Available Windows Updates in PowerShell
To check for available Windows updates in PowerShell, use the Get-WindowsUpdate
cmdlet available in the PSWindowsUpdate module.
Get-WindowsUpdate
How to Install All Available Windows Updates using PowerShell
To install all available Windows updates in PowerShell, use the Install-WindowsUpdate
command available in the PSWIndowsUpdate module.
Install-WindowsUpdate -AcceptAll
The above PowerShell command Install-WndowsUpdate
uses the parameter -AcceptAll
to install all updates in Windows.
After the installation of the Windows update, check if the reboot is required using the Get-WURebootStatus command available in the PSWindowsUpdate
module.
How to Remove a Windows Update in PowerShell
You can use the PowerShell command Remove-WindowsUpdate
available in the PSWindowsUpdate module to remove a Windows Update.
Remove-WindowsUpdate -KBArticleID KB4601395
In the above PowerShell script, the Remove-WindowsUpdate
command removes a Windows update having KBArticleId KB4601395.
How to Hide Windows Update in PowerShell
The PowerShell command to hide Windows updates is Hide-WindowsUpdate
.
Hide-WindowsUpdate -KBArticleID KB4601395
This PowerShell command Hide-WindowsUpdate
uses the parameter -KBArticleId
as KB4601395 to hide updates.
How to View the Windows Update History in PowerShell
To view the Windows Update History in PowerShell, use the command Get-WUHistory
.
Get-WUHistory
The above PowerShell command Get-WUHistory
returns the list of Windows updates along with ComputerName, OperationName, Result, Date, and Title.
Cool Tip: How to get the last 30 days of Updates in PowerShell!
How to List Available Updates using PowerShell
The PowerShell command to list available Windows Updates is Get-WUList
.
Get-WUList
This PowerShell command returns the list of updates available for the current computer.
To check the list of available Windows updates on a remote computer, run the following command.
Get-WUList -Computer INCOR-EU-20
Cool Tip: How to check Windows update installed using PowerShell!
Conclusion
I hope the above article on how to use the PSWindowsUpdate
module in PowerShell is helpful to you.
The PSWindowsUpdate module provides cmdlets for managing Windows updates. You can learn more about the PackageManagement module that is used to manage software packages.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.