Installing Windows Updates manually can be a elevate. Why not automate the entire process with PowerShell? Get started decision-making Windows updates with the PSWindowsUpdate module in PowerShell!
In this tutorial, you will learn how to download and install updates on your Windows motorcar through PowerShell.
Prerequisites
This tutorial uses Windows 10 Build 19042 for demonstrations throughout this tutorial, only older ones, such equally Windows vii and eight.1, volition piece of work.
Installing the PSWindowsUpdate Module
The PSWindowsUpdate module is a 3rd-party module bachelor in PowerShell Gallery that lets you manage Windows updates from the PowerShell console. The PowerShell Gallery is the fundamental repository where yous tin can find and share PowerShell modules.
With the PSWindowsUpdate module, you can remotely check, install, update and remove updates on Windows servers and workstations. But first, you demand to install the PSWindowsUpdate module on your machine.
1. Open PowerShell as administrator.
2. Run the Install-Module command to download and install the PSWindowUpdate module from the PowerShell gallery repository. The -Force parameter tells the command to ignore prompt letters and continue installing the module.
If you're on an older version of Windows, you can download the PSWindowsUpdate module manually.
iii. Adjacent, run the Import-Module command below to import the PSWindowsUpdate module to PowerShell'due south current session. One time imported, yous tin can and then use the module to manage Windows updates on your auto.
You lot may run into an error importing the module for the outset fourth dimension maxim "The specified module 'PSWindowsUpdate' was non loaded". In that case, you must allow executing scripts on your machine.
Run the control Set-ExecutionPolicy -ExecutionPolicy RemoteSigned to enable execute remote scripts on your computer. Now try importing the PSWindowsUpdate module over again.
Import-Module PSWindowsUpdate
four. Finally, run the control below to see all commands (Go-Control) available for the PSWindowsUpdate module. Some of these commands are what y'all volition use to manage Windows updates on your car. Go-Control -Module PSWindowsUpdate
Become-Command -Module PSWindowsUpdate
Checking for Bachelor Windows Updates
With the PSWindowsUpdate module installed, you can now run a command to listing the updates available for your computer earlier installing them. Checking the list of updates is a good do to avoid installing an update you don't need.
Run the Get-WindowsUpdate command to listing all the Windows updates
Below, yous can come across the list of available Windows updates along with their Noesis-Base (KB) numbers. Accept note of any KB number of a Windows update that you lot may want to prevent installing later, mayhap one that you lot deem non important.
Perhaps you lot also want to cheque where Windows gets an update from to see if the source is trustworthy. If then, the Go-WUServiceManager control will do the trick.
Run the Get-WUServiceManager to show the list of available update services.
There's no official documentation about the update the sources, but each is divers below:
Microsoft Update – the standard update source
DCat Flighting Prod – an alternative MS supdate ource for specific flighted update items (from previews, etc)
Windows Store (DCat Prod) – ordinarily just Windows Store, simply has Dcat Prod when for insider preview PC
Windows Update – an older update source for Windows Vista and older Windows Bone.
Excluding Windows Updates from Installing
At present you've seen the Windows updates available, perhaps you prefer not to install some of them on your figurer. In that case, you can choose not to install them by hiding them.
Run the Hibernate-WindowsUpdate control below to hibernate a Windows update tagged with the specified KB number (-KBArticleID KB4052623). Y'all can specify the KB number you took note of in the "Checking for Available Windows Updates" department instead.
PowerShell volition ask for your confirmation earlier executing the command. Ostend the command with the "A" key, then press Enter.
Hibernate-WindowsUpdate -KBArticleID KB4052623
If you alter your mind and want to install the update in the future, yous can show the update similar to how y'all hid the update. To show the update, run the Show-WindowsUpdate command along with the update'due south KB number, like this: Show-WindowsUpdate -KBArticleID KB4052623
Installing Windows Updates
Now that y'all can discover and exclude some updates from installing, permit's at present bank check out how to install them.
But earlier installing updates, checking if updates require a system reboot is a practiced practice. Why? Knowing whether the Windows updates require a reboot beforehand tells you lot to save all your piece of work and complete other ongoing installations before diving to the Windows update.
Now run the Get-WURebootStatus command to determine if whatever of the Windows updates crave a reboot. The command returns either Truthful or Faux value to indicate the reboot status
Below, yous can run across the command returned a False value, which indicates a reboot is not required. And so get nuts and install the updates you deem are necessary.
Downloading and Installing All Available Updates
If you're not picky when it comes to updates, running the Install-WindowsUpdate command on its own lets you install all available Windows updates. But maybe, yous desire to install the updates without having to accept prompts. If so, you need to add together the -AcceptAll parameter as shown below.
Run the Install-WindowsUpdate command beneath to install all available Windows updates. The -AcceptAll parameter tells the control to suppress prompts and continue installing all updates.
If you adopt to reboot your computer in one case the installation is completed automatically, add the -AutoReboot parameter.
Install-WindowsUpdate -AcceptAll -AutoReboot
If you prefer to install selected updates only, add the -KBArticleID parameter in the Install-WindowsUpdate control, followed past the update's KB number, like this: Install-WindowsUpdate -KBArticleID KB2267602
Checking Windows Update History
Now you have installed windows updates on your computer, but perhaps something has gone wrong during the installation. If so, yous can bank check your update history using the Get-WUHistory command. The Get-WUHistory prints out all the installed updates to the console with their installation upshot.
Run the Get-WUHistory command below to check Windows update history.
Below, yous can see that most of the updates take the Succeeded result condition, while some have InProgress status.
Uninstalling Windows Updates
At that place are times when you install an update yous don't deem of import at the moment, or there are updates you suspect of causing an issue on your organisation. In those times, you lot tin properly uninstall the updates with the Remove-WindowsUpdate command.
Run the Remove-WindowsUpdate command beneath to uninstall a Windows update tagged with a specific KB number (-KBArticleID KB2267602).
PowerShell volition require confirmation earlier executing the command. Press the "A" key and hitting enter to confirm the command.
Remove-WindowsUpdate -KBArticleID KB2267602
Conclusion
Throughout this tutorial, you lot've learned near the PSWindowsUpdate Module. You've also gone through selectively installing and uninstalling Windows updates.
You've learned that you have full control over the Windows updates with PowerShell. Now, would you prefer installing updates in PowerShell over a GUI method? Maybe learn more than about building a Windows update written report?
0 Response to "What Services Does Windows Update Use"
Post a Comment