Menu
Business.com aims to help business owners make informed decisions to support and grow their companies. We research and recommend products and services suitable for various business types, investing thousands of hours each year in this process.
As a business, we need to generate revenue to sustain our content. We have financial relationships with some companies we cover, earning commissions when readers purchase from our partners or share information about their needs. These relationships do not dictate our advice and recommendations. Our editorial team independently evaluates and recommends products and services based on their research and expertise. Learn more about our process and partners here.
Make it easier for non-PowerShell users to navigate your scripts.
If you’re confident with coding, you may find it easier to install Windows patches with PowerShell than to use Microsoft’s system. With PowerShell, you can remotely manage updates across multiple devices and customize how the update process works on each, similar to how you can remotely invoke applications with PowerShell to enhance efficiency and control. In addition, you can check for, remove and hide updates without being physically at your computer. Here’s a look at how to install Windows patches with PowerShell for free.
PSWindowsUpdate is a community PowerShell module available via the PowerShell Gallery. In your PowerShell session, run Install-Module PSWindowsUpdate to download and install the latest version. The download should be quick. Once it’s downloaded, the module’s commands will be available to you. To view all available commands, run Get-Command -Module PSWindowsUpdate, and you’ll notice that you can perform many tasks beyond installing patches.
William Mabotja, an Azure-certified senior software developer at Atlas Finance, advised launching PowerShell as an administrator and running Install-Module -Name PSWindowsUpdate. “This command fetches the module from the PowerShell Gallery, making it available for your use,” Mabotja explained. “After installation, import it with Import-Module PSWindowsUpdate. Following these steps ensures a secure and up-to-date system without unnecessary hassle.”
Before installing patches, you must determine which patches are needed across your systems. The PSWindowsUpdate module provides a command called Get-WindowsUpdate that you can use to discover any missing patches. The Get-WindowsUpdate command supports querying the local computer or remote computers.
When you run this command, it returns a list of all the missing updates on whatever computer you target. Here’s an example:
Mabotja emphasized that PowerShell significantly enhances update management for businesses that handle multiple devices by providing a centralized, scriptable interface that simplifies the update process across various systems. “For example, administrators can efficiently manage updates on numerous virtual machines (VMs) or physical devices simultaneously, reducing the time and effort required for manual updates,” Mabotja explained.
Once you know what you’re missing, take that information and install the patches. Get-WindowsUpdate provides many different parameters to query and install updates; in fact, it would be ideal for an interactive menu written in PowerShell designed for noncoders. For example, if you want to install the list of patches provided with the Get-WUList cmdlet, take the next logical step and install them with the Get-WindowsUpdate cmdlet. [Read related article: Why Speaking in Jargon Doesn’t Make You Look Smarter]
Mabotja appreciates PowerShell’s flexibility. “Running PowerShell as ‘Run as Administrator’ gives you access to low-level file systems,” he noted. “This makes it easier to install updates that need elevated permissions. With PowerShell, you can automate and customize the update process, helping you create a more reliable and manageable Windows environment.”
A patch can be in several different states, such as available, downloaded and installed. Some patches need a reboot to complete an installation, while others don’t. The Get-WindowsUpdate command gives you the flexibility to choose which updates are installed.
For example, say you care only about installing the missing updates. In this case, you can tell Get-WindowsUpdate to install all missing patches, accept every one it finds and initiate a reboot if necessary.
Or, you could be a little gentler and pick specific updates, using the KBArticleId parameter. The following command would install only that particular KB, and if the computer needed a reboot, it would let you know rather than automatically rebooting.
PowerShell offers powerful tools for update management. Consider the following additional issues to better understand the potential challenges and opportunities:
The PSWindowsUpdate module has many options and uses — too many to cover in one article. Download it and try it for yourself. Check out the extensive help documentation for each function if you’re unfamiliar with the syntax.
If you have the patience to learn this module, you can build some advanced update management solutions. PowerShell is also a great way to perform other tasks more efficiently. For example, you can make a web scraping tool in PowerShell to download competitors’ prices.
Adam Bertram contributed to this article.