Last Update: Sep 04, 2024 | Published: Jul 30, 2020
Windows is notorious for the number of system updates that are necessary and how often they come out. These updates are important, not only to keep your system running well, but also to keep your system secure.
Of course, managing these updates can sometimes be a pain, especially if you aren’t aware of what is running. In this article, we look into how to manage Windows 10 updates in PowerShell via the PSWindowsUpdate module.
To use PowerShell, simply type Start→Run→”powershell” in the run dialog box and while holding Ctrl and Shift, click Ok. The reason to hold Ctrl and Shift is to run PowerShell in an elevated prompt, which is necessary for this module. The version that will launch, by default, will be PowerShell 5.1, which is the last built-in version of PowerShell.
Running the latest version of PowerShell, with its many performance enhancements and features, is recommended. To install PowerShell 7, you will want to navigate to the PowerShell development page, click on the Windows (x64) .msi under Downloads (Stable) and install the package.
We can verify that the module is correctly loaded by running the Get-Module
command to find out if the PSWindowsUpdate module is available to PowerShell and that the right version is installed.
Get-Module -Name PSWindowsUpdate
So what commands are available to use in this module? As you can see from the listing of commands below, we have a number of options to not only list available updates, but to manage them as well.
In this article, we won’t go into detail on all of them, but if you want to go furthter, see the Package Details on the PowerShell Gallery page. Some of the commands such as Enable-WURemoting
are useful when you want to manage other Windows 10 systems remotely, but are beyond the scope of this article.
To see the history of what updates have been installed so far, and what their status is, we can run the Get-WUHistory
command. In the command below, we are limiting the results to only the first 10.
Get-WUHistory | Select-Object -First 10
To see pending installs, we can use the Get-WUInstall
function. In the example below, there is only one pending install right now.
Get-WUInstall
Get-WUInstall
is actually an alias for theInstall-WindowsUpdate
command.
Now that we know we have an update that needs to be installed, how can we start this update installation? Thankfully, this is a simple operation as we know the KB number of the update.
Get-WindowsUpdate -KBArticleID KB2267602 -Install
What’s very useful about the function is that it will display each step of the process as it goes. There are a lot of
What’s very useful about the function is that it will display each step of the process as it goes. There are a lot of other command possibilities with Get-WindowsUpdate
. Some of them are listed below, but this is not an exhaustive list.
-Hide
– This will hide an update from the updates list. This is useful if there is an optional update that you have no intention of installing.-AcceptAll
– Accept all confirmations to continue with the installation procedure and not pause for confirmation.-AutoReboot
– Reboot the system if the update requires that.-IsHidden
– List all hidden updates.-IsInstalled
– Return if the update(s) are installed.-ScheduleJob
– When given a date time, this will tell Windows Update to not install until the specified time.-ScheduleReboot
– Similar to ScheduleJob
, this will schedule a time for a reboot when given a date time.Perhaps, we realized that we shouldn’t have installed that update. To remove the previously installed Windows Update, we can simply use the Remove-WindowsUpdate
command line.
Remove-WindowsUpdate -KBArticleID KB2267602
Much like Get-WindowsUpdate
this command supports -AutoReboot
, -ScheduleJob
, and -ScheduleReboot
. What this command does additionally offer is the -IgnoreReboot
command which will perform the uninstall but not schedule or force a reboot if the update asks for it.
With Windows Update, there are a number of providers that can be the source of updates. By default, most Windows 10 systems are not configured to look at the Microsoft Update service which is different than the Windows Update service. Generally, Microsoft Update offers more optional updates. As you can see below, Microsoft Update is not in the list.
Nonetheless, we can actually search for Microsoft Updates to install by running the following command.
Get-WindowsUpdate -MicrosoftUpdate
Now we run the Get-WindowsUpdate
command, you can see that it will return the new optional updates without specifying the -MicrosoftUpdate
parameter.
As you can see, using the PSWindowsUpdate module makes managing local Windows Updates much easier. With the ability to also add update providers, this can quickly and easily become a go-to module for advanced Windows Update management.
With regular updates and new functionality being added all the time, the PSWindowsUpdate module is a must-have for Windows 10 power users that want additional control over their system!