| by Arround The Web | No comments

Getting Started With PowerShell and the PSWindowsUpdate Module

The “PSWindowsUpdate” module is used to manage the Windows update in PowerShell. It does not come pre-installed on Windows. However, it is available in the PowerShell gallery repository for installation. It allows the administrators to remotely install, remove, check, or hide Windows updates on workstations and servers.

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:

Install-Module -Name PSWindowsUpdate

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:

Import-Module PSWindowsUpdate

Example 3: Get the List of Commands of “PSWindowsUpdate” Module

This example will retrieve the list of commands related to the Windows update:

Get-Command -Module PSWindowsUpdate

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:

Get-WindowsUpdate

Example 5: Get the List of Windows Update Services

The services related to Windows update can be retrieved by executing the command mentioned below:

Get-WUServiceManager

Example 6: Hide the Windows Update Using the “Hide-WindowsUpdate” Cmdlet

Executing the line of code below will help the Windows update to hide:

Hide-WindowsUpdate -KBArticleID KB2267602

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:

Get-WURebootStatus

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:

Install-WindowsUpdate -AcceptAll

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:

Get-WUHistory

Example 10: Remove or Uninstall the Windows Update Using “Remove-WindowsUpdate”

This particular example will uninstall the specified update using PowerShell:

Remove-WindowsUpdate -KBArticleID KB2267602

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.

Share Button

Source: linuxhint.com

Leave a Reply