Managing Updates with PSWindowsUpdate

by Mar 23, 2020

There are many useful PowerShell modules available from the PowerShell Gallery. One helps you managing updates. To download and install it, run:

 
PS> Install-Module -Name PSWindowsUpdate -Scope CurrentUser -Force

It adds a list of new commands related to Windows Update:

 
PS> Get-Command -Module PSWindowsUpdate 

CommandType Name                    Version Source         
----------- ----                    ------- ------         
Alias       Clear-WUJob             2.1.1.2 PSWindowsUpdate
Alias       Download-WindowsUpdate  2.1.1.2 PSWindowsUpdate
Alias       Get-WUInstall           2.1.1.2 PSWindowsUpdate
Alias       Get-WUList              2.1.1.2 PSWindowsUpdate
Alias       Hide-WindowsUpdate      2.1.1.2 PSWindowsUpdate
Alias       Install-WindowsUpdate   2.1.1.2 PSWindowsUpdate
Alias       Show-WindowsUpdate      2.1.1.2 PSWindowsUpdate
Alias       UnHide-WindowsUpdate    2.1.1.2 PSWindowsUpdate
Alias       Uninstall-WindowsUpdate 2.1.1.2 PSWindowsUpdate
Cmdlet      Add-WUServiceManager    2.1.1.2 PSWindowsUpdate
Cmdlet      Enable-WURemoting       2.1.1.2 PSWindowsUpdate
Cmdlet      Get-WindowsUpdate       2.1.1.2 PSWindowsUpdate
Cmdlet      Get-WUApiVersion        2.1.1.2 PSWindowsUpdate
Cmdlet      Get-WUHistory           2.1.1.2 PSWindowsUpdate
Cmdlet      Get-WUInstallerStatus   2.1.1.2 PSWindowsUpdate
Cmdlet      Get-WUJob               2.1.1.2 PSWindowsUpdate
Cmdlet      Get-WULastResults       2.1.1.2 PSWindowsUpdate
Cmdlet      Get-WURebootStatus      2.1.1.2 PSWindowsUpdate
Cmdlet      Get-WUServiceManager    2.1.1.2 PSWindowsUpdate
Cmdlet      Get-WUSettings          2.1.1.2 PSWindowsUpdate
Cmdlet      Invoke-WUJob            2.1.1.2 PSWindowsUpdate
Cmdlet      Remove-WindowsUpdate    2.1.1.2 PSWindowsUpdate
Cmdlet      Remove-WUServiceManager 2.1.1.2 PSWindowsUpdate
Cmdlet      Set-PSWUSettings        2.1.1.2 PSWindowsUpdate
Cmdlet      Set-WUSettings          2.1.1.2 PSWindowsUpdate
Cmdlet      Update-WUModule         2.1.1.2 PSWindowsUpdate 

Most commands require an elevated shell to work properly but basic information is available for everyone.

 
PS> Get-WULastResults
WARNING: To perform some operations you must run an elevated Windows PowerShell console.

ComputerName    LastSearchSuccessDate LastInstallationSuccessDate
------------    --------------------- ---------------------------
DESKTOP-8DVNI43 22.01.2020 11:29:24   22.01.2020 11:29:52        



PS> Get-WUApiVersion
WARNING: To perform some operations you must run an elevated Windows PowerShell console.

ComputerName PSWindowsUpdate PSWUModuleDll   ApiVersion WuapiDllVersion                                                                  
------------ --------------- -------------   ---------- ---------------                                                                  
DESKTOP-8... 2.1.1.2         2.0.6995.28496  8.0        10.0.18362.387  

 


You are a PowerShell Professional, passionate about improving your code and skills? You take security seriously and are always looking for the latest advice and guidance to make your code more secure and faster? You’d love to connect to the vibrant PowerShell community and get in touch with other PowerShell Professionals to share tricks and experience? Then PowerShell Conference EU 2020 might be just the right place for you: https://psconf.eu (June 2-5, 2020 in Hanover, Germany).

It’s a unique mixture of classic conference with three parallel tracks filled with fast-paced PowerShell presentations, and advanced learning class with live discussions, Q&A and plenty of networking.

Secure your seat while they last: https://psconf.eu/register.html. The speakers and agenda is available here: https://psconf.eu/schedule.

Twitter This Tip! ReTweet this Tip!