The following post will overview a detailed guide about the PowerShell module “PSWindowsUpdate”.
Getting Started With PowerShell and the PSWindowsUpdate Module
As described earlier, the “PSWindowsUpdate” module is designed to manage the Windows updates including installing, updating, hiding, or removing updates.
Example 1: Install the “PSWindowsUpdate” Module Using PowerShell
In order to install the “PSWindowsUpdate” module simply execute the command below:
In the above code snippet:
First, define the “Install-Module” cmdlet.
After that, write the “-Name” parameter and specify the “PSWindowsUpdate” module:
Example 2: Import “PSWindowsUpdate” Module in PowerShell
This demonstration will help to import the “PSWindowsUpdate” module using PowerShell. For that, simply write the “Import-Module” and specify the “PSWindowsUpdate” module:
Example 3: Get the List of Commands of “PSWindowsUpdate” Module
This example will retrieve the list of commands related to the Windows update:
According to the above code:
First, write the “Get-Command” cmdlet.
Then, add the “-Module” parameter and specify the “PSWindowsUpdate” module:
Example 4: Get the Windows Update Using PowerShell
This illustration will get the available updates by executing the mentioned command:
Example 5: Get the List of Windows Update Services
The services related to Windows update can be retrieved by executing the command mentioned below:
Example 6: Hide the Windows Update Using the “Hide-WindowsUpdate” Cmdlet
Executing the line of code below will help the Windows update to hide:
In the above-mentioned code:
First, write the “Hide-WindowsUpdate” cmdlet.
After that, add the “-KBArticleID” parameter and specify the update ID:
Example 7: Check if the Reboot is Needed or Not
Sometimes after updating Windows, it is required to reboot the system. So, execute the given command to check whether it is required to reboot Windows or not:
Example 8: Install the Windows Update Using the “Install-WindowsUpdate” Cmdlet
In order to install the Windows update, simply execute the below-provided line of code:
In the above-stated code:
First, write the “Install-WindowsUpdate” cmdlet along with the “-AcceptAll” parameter:
Example 9: Use the “Get-WUHistory” Cmdlet to Get the Updates History
To get the Windows update history, execute the below code:
Example 10: Remove or Uninstall the Windows Update Using “Remove-WindowsUpdate”
This particular example will uninstall the specified update using PowerShell:
That was all about PowerShell and the “PSWindowsUpdate” module.
Conclusion
The “PSWindowsUpdate” module helps manage the Windows update. It installs, updates, hides, or removes Windows updates. This module is not the built-in feature of Windows. Instead, it is available in the PowerShell repository for installation. This post has elaborated on the mentioned query in detail.