Home » PowerShell » PSWindowsUpdate – Manage Windows Updates

PSWindowsUpdate – Manage Windows Updates

`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:

  1. Check for available Updates
  2. Install Windows Updates
  3. Remove Windows Updates
  4. Hide Updates
  5. View Update History
  6. 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.

Install PSWindowsUpdate in PowerShell
Install PSWindowsUpdate in PowerShell

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.

  1. Clear-WUJob: Clear a Windows Update job from Task Scheduler.
  2. Download-WindowsUpdate: Download available Windows updates.
  3. Get-WUInstall: Get information about pending Windows updates for installation.
  4. Get-WUList: Display a list of available Windows updates.
  5. Hide-WindowsUpdate: Hide a specific Windows update.
  6. Install-WindowsUpdate: Install pending Windows updates.
  7. Show-WindowsUpdate: Display hidden Windows updates.
  8. UnHide-WindowsUpdate: Unhide a previously hidden Windows update.
  9. Uninstall-WindowsUpdate: Uninstall a specific Windows update.
  10. Add-WUServiceManager: Register the Windows Update Service Manager.
  11. Enable-WURemoting: Enable Windows Defender firewall rules for remote PSWindowsUpdate usage.
  12. Get-WindowsUpdate: Get a list of available Windows updates and manage their installation.
  13. Get-WUApiVersion: Retrieve the Windows Update Agent version.
  14. Get-WUHistory: Display the history of installed updates.
  15. Get-WUInstallerStatus: Check the Windows Installer service status.
  16. Get-WUJob: Check for Windows Update job tasks in Task Scheduler.
  17. Get-WULastResults: Get the last search and installation results.
  18. Get-WUOfflineMSU: Retrieve offline MSU file information.
  19. Get-WURebootStatus: Check if a system reboot is required for updates.
  20. Get-WUServiceManager: List available update sources.
  21. Get-WUSettings: Retrieve Windows Update client settings.
  22. Invoke-WUJob: Remotely execute PSWindowsUpdate tasks.
  23. Remove-WindowsUpdate: Remove a specific Windows update.
  24. Remove-WUServiceManager: Disable the Windows Update Service Manager.
  25. Reset-WUComponents: Reset the Windows Update agent to its default state.
  26. Set-PSWUSettings: Save PSWindowsUpdate module settings to an XML file.
  27. Set-WUSettings: Configure Windows Update client settings.
  28. 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.