Getting Started with PowerShell and the PSWindowsUpdate Module

choubertsprojects

VPN offers!

1. NordVPN

2. Surfshark

3. ExpressVPN

PowerShell is a scripting language designed to help IT professionals automate administrative tasks. With the PSWindowsUpdate module, you can easily configure Windows Update settings and keep your laptop or workstation up-to-date without having to leave the desktop!

The “get-wulist” is a command that can be used to list the updates that are available for PowerShell. The “PSWindowsUpdate Module” is a module that allows users to easily create and update Windows Update packages.

Getting Started with PowerShell and the PSWindowsUpdate Module

Manually Windows Updates Installation may be a pain. Why not use PowerShell to automate the whole process? With the PSWindowsUpdate module in PowerShell, you can start managing Windows updates right now!

In this article, you’ll learn how to use PowerShell to download and install updates on your Windows PC.

Prerequisites

For demos, this guide utilizes Windows 10 Build 19042, however previous versions, such as Windows 7 and 8.1, will also function.

PSWindowsUpdate Module Installation

The PSWindowsUpdate module is a PowerShell Gallery third-party module that allows you to handle Windows updates from the PowerShell console. The PowerShell Gallery is a central repository where PowerShell modules may be found and shared.

You may check, install, update, and uninstall updates on Windows servers and workstations remotely using the PSWindowsUpdate module. However, you must first install the PSWindowsUpdate module on your computer.

1. Log in as an administrator to PowerShell.

2. Use the Install-Module command to get the PSWindowUpdate module from the PowerShell gallery repository and install it. The -Force argument instructs the command to disregard any prompt messages and proceed with the module installation.

PSWindowsUpdate -Force Install-Module

You may manually download the PSWindowsUpdate module if you’re using an earlier version of Windows.

3. Finally, use the Import-Module command to add the PSWindowsUpdate module to the current PowerShell session. After you’ve imported the module, you may use it to control Windows updates on your PC.

When you initially import the module, you can get an error that says “The requested module ‘PSWindowsUpdate’ was not loaded.” In such situation, you must enable scripts to run on your computer.

To allow remote script execution on your machine, use the command Set-ExecutionPolicy -ExecutionPolicy RemoteSigned. Now import the PSWindowsUpdate module once again.

PSWindowsUpdate-Import-Module

4. Finally, use the command below to examine all of the PSWindowsUpdate module’s commands (Get-Command). You’ll use some of these commands to control Windows updates on your system. PSWindowsUpdateGet-Command -Module Get-Command -Module Get-Command -Module Get

PSWindowsUpdateGet-Command -Module Get-Command -Module Get-Command -Module Get

Windows Updates are being checked for.

You may now execute a command to show the updates available for your machine before installing them, thanks to the PSWindowsUpdate module. Checking the update list is an useful way to prevent installing anything you don’t need.

To get a list of all Windows updates, use the Get-WindowsUpdate command.

The available Windows updates are shown here, along with their Knowledge-Base (KB) numbers. Make a note of any KB numbers for Windows updates that you may wish to avoid installing later, such as those that you don’t think are necessary.

Available Windows Updates are listed below. Available Windows Updates are listed below.

You may also want to look into where Windows obtains its updates to determine whether the source is reliable. If that’s the case, the Get-WUServiceManager command will suffice.

To get a list of available update services, use Get-WUServiceManager.

Although there is no formal guidance on how to update the sources, the following definitions are provided:

  • The normal update source is Microsoft Update.
  • DCat Flighting Prod is a Microsoft update source for particular flighted update items (from previews, etc)
  • Windows Store (DCat Prod) – typically only Windows Store, but for insider preview PCs has Dcat Prod.
  • Windows Update is a legacy update source for Windows Vista and earlier Windows operating systems.

Where Do Windows Updates Come From? Where Do Windows Updates Come From?

Allowing Windows Updates to be Installed

You may decide not to apply some of the Windows updates now that you’ve seen what’s available. You may opt not to install them in such case by concealing them.

Run the Hide-WindowsUpdate command below to hide a Windows update tagged with the specified KB number (-KBArticleID KB4052623). You can specify the KB number you took note of in the “Windows Updates are being checked for.” section instead.

Before performing the operation, PowerShell will ask for confirmation. With the “A” key, confirm the instruction, then hit Enter.

Hide-WindowsUpdate -KBArticleID KB4052623 -KBArticleID KB4052623 -KBArticleID KB40526

Hiding an Update Based on the Update's KB Number Hiding an Update Based on the KB Number of the Update

If you change your mind and wish to apply the update later, you may display it again in the same way you concealed it. To see the update, type Show-WindowsUpdate followed by the update’s KB number, as seen below: KBArticleID KB4052623 -Show-WindowsUpdate

Windows Updates Installation

Let’s look at how to install them now that you’ve discovered and excluded certain updates from installing.

However, it is a good habit to verify whether updates need a system reboot before installing them. Why? Knowing if Windows updates need a reboot informs you to save all of your work and finish any other ongoing installs before proceeding with the Windows update.

To see whether any of the Windows updates need a reboot, execute the Get-WURebootStatus command. The reboot state is indicated by a True or False result returned by the command.

As you can see in the screenshot below, the command returned a False response, indicating that a reboot is not necessary. So go crazy and install all of the updates you think you need.

Checking if Reboot is Required After Windows Updates Installation Checking if Reboot is Required After Windows Updates Installation

How to Check in the Registry for a Pending Reboot (Windows)

All Updates Are Being Downloaded and Installed

Running the Install-WindowsUpdate command on its own will install all available Windows updates if you’re not choosy about them. However, it’s possible that you’d want to apply the updates without having to accept prompts. If this is the case, you must provide the -AcceptAll argument, as illustrated below.

To install all available Windows updates, use the Install-WindowsUpdate command shown below. The -AcceptAll argument instructs the command to ignore all prompts and proceed with the installation of all updates.

If you want your machine to reboot when the installation is finished automatically, use the -AutoReboot argument.

-AcceptAll -AutoReboot -Install-WindowsUpdate

All Windows Updates Must Be Installed All Windows Updates Must Be Installed

If you only want to install certain updates, use the -KBArticleID argument in the Install-WindowsUpdate command, followed by the KB number of the update, as shown below: KBArticleID KB2267602 -Install-WindowsUpdate

Checking the Update History in Windows

Now that you’ve installed Windows updates on your computer, it’s possible that anything went wrong throughout the process. If that’s the case, you may use the Get-WUHistory command to look up your update history. The Get-WUHistory cmdlet publishes a list of all installed updates along with their installation status to the console.

To check the history of Windows updates, use the Get-WUHistory command.

The majority of the changes have the Succeeded result status, but others have the InProgress state, as seen below.

Viewing the Update History in Windows Viewing the Update History in Windows

UnWindows Updates Installation

There are occasions when you install an update that you don’t think is necessary at the time, or when you believe an update is creating a problem with your system. When this happens, use the Remove-WindowsUpdate command to properly remove the updates.

To remove a Windows update labeled with a certain KB number, use the Remove-WindowsUpdate command shown below (-KBArticleID KB2267602).

Before performing the operation, PowerShell will ask for confirmation. To confirm the instruction, press the “A” key and enter.

KBArticleID KB2267602 -Remove-WindowsUpdate

UnWindows Updates Installation UnWindows Updates Installation

Conclusion

Throughout this tutorial, you’ve learned about the PSWindowsUpdate Module. You’ve also gone through selectively installing and unWindows Updates Installation.

With PowerShell, you’ve discovered that you have complete control over Windows updates. Would you rather use PowerShell to install updates than use the graphical user interface? Perhaps you’d like to learn more about how to create a Windows update report?

How to Create a Simple PowerShell Windows Updates Report

PowerShell is a command-line shell and scripting language created by Microsoft. It provides an interactive console, as well as tools for system administration. PowerShell also has several features to help automate the management of Windows updates. The “powershell install windows updates remotely” is one such feature that allows users to update their systems without ever leaving the comfort of their computer’s desktop.

Frequently Asked Questions

What is PSWindowsUpdate?

A: PSWindowsUpdate is a service to update your Sony Playstation 4 console

Is install-module PSWindowsUpdate safe?

A: Install-module PSWindowsUpdate is safe.

How do I install Windows updates from PowerShell?

A: The following command will install the latest updates from your current Windows installation.
PowerShell -ExecutionPolicy Unrestricted .\Install-WindowsUpdate

Related Tags

  • pswindowsupdate.zip download
  • pswindowsupdate module download
  • powershell script to install windows updates and reboot
  • pswindowsupdate source code
  • pswindowsupdate github