Keeping Windows updated is critical for performance, stability, and security. Instead of relying on the standard Windows Update interface, you can take full control with PowerShell. Using the PSWindowsUpdate module, you can search, install, and even automate updates — all from the command line.
Prerequisite
Before installing updates with PowerShell, you’ll need to allow trusted scripts to run. Open PowerShell as Administrator and run:
Set-ExecutionPolicy RemoteSignedThis enables execution of locally created and trusted scripts.
Install the PSWindowsUpdate Module
Install-Module -Name PSWindowsUpdate -ForceImport the Module
Import-Module PSWindowsUpdateCheck for Available Updates
Get-WindowsUpdateOptional Parameters:
-AcceptAll→ Auto-approve updates-Install→ Begin installation immediately
Install Updates and Reboot If Needed
Get-WindowsUpdate -AcceptAll -Install -AutoRebootThis command will install all available updates and automatically restart if required.
✅ Pro Tip: Automating this process with scheduled tasks can keep servers and workstations consistently patched without manual intervention.
Updating Windows via PowerShell
Using PowerShell to update windows has been a huge time saver for us