![Open PowerShell logo indicating an executing update script.](https://happycattech.com/wp-content/uploads/2024/07/PowerShell.png)
Several writers have reported long delays in using the Windows 10/11 update GUI. After reading the comments on a recent Krebs on Security post, I decided to share a couple of PowerShell update scripts that I use for Windows 10 updating. The following two scripts were something I came across while working as system administrator for Rez Church (Resurrection Fellowship) in Loveland, Colorado, back in the late 2010’s. I don’t recall their origin other than they came from the web…
These were originally developed for use with Windows Server 2012 using PowerShell. The script works with Windows 10 without the overhead of the GUI. However I have not tested the script with Windows 11. If someone is willing to donate a Windows 11 compatible tower or laptop for testing purposes, we would be much obliged. 😉
The PowerShell script contains two parts, the installer, and the normal update. Please be aware that these scripts install ALL pending updates and doesn’t give you a choice on which updates to install.
To use these PowerShell scripts, first create the following two scripts as .ps1 files, somewhere on system storage that is easily accessible from a PowerShell terminal. Use the extension .ps1 for convention. After creating your scripts, open an elevated PowerShell terminal. Then, from that terminal, either call the path to your scripts or cd to the path where your PowerShell scripts reside and execute the script there.
Here is the installer script. It installs the module PSWindowsUpdate, then updates the system.
Get-PackageProvider -name nuget -force
Install-Module PSWindowsUpdate -confirm:$false -force
Get-WindowsUpdate -Install -acceptall -IgnoreReboot
$Shell = New-Object -ComObject "WScript.Shell"
$Button = $Shell.Popup("Click OK to continue.", 0, "Done!", 0)
Following is the normal update script.
Get-WindowsUpdate -Install -acceptall -IgnoreReboot
BTW, you don’t have to create the files. If you cut and paste the above code into an elevated PowerShell terminal, that will also work.