How to Run Windows Update from Command Prompt or PowerShell in Windows 10/11 & Server 2016/2019.
If you want to run Windows Update from Command Prompt or PowerShell in Windows 10/11, continue reading below.
Microsoft releases updates regularly to enhance security, fix bugs, and introduce new features that improve the functionality of Windows devices.
Windows updates are divided into 2 categories: Quality updates, which are constantly released for security reasons and to fix glitches, and Feature updates, which offer improved versions and additional features.
The usual way to update Windows 10/11 is by going to Settings > Update & Security and to check and install updates, but in some cases may needed to install updates from the command line or PowerShell if the usual way doesn't work.
This tutorial contains instructions on how run Windows Update and install or uninstall Updates with commands in Command Prompt & PowerShell.
How to Check and Install Updates from PowerShell or Command Prompt in Windows 10/11 & Server 2016/2019.
- Part 1. Install Updates from Command Line.
- Part 2. Install Updates from PowerShell.
- Part 3. Uninstall Updates from PowerShell.
Part 1. How to Run Windows Update from Command Prompt.
In previous versions of Windows you could update Windows using the command "wuauclt /detectnow /updatenow".
In latest Windows 10 versions the command 'WUAUCLT.EXE' does not work anymore and has been replaced by the command 'USOCLIENT.EXE'.
Info: The 'USOCLIENT.EXE' is the Update Session Orchestrator client that used to download and install Windows Updates. *
1. According to reports, not all Windows 10 and 11 versions support the USOCLIENT. If the same is true for your device, update your system using the PowerShell method.
2. Since USOCLIENT commands do not display anything on the screen at the time they are executed, the only way to determine if the command is working is to look at the events in the following destinations.
- Task Scheduler -> Microsoft -> Windows -> Update Orchestrator
To install updates with 'USOCLIENT.EXE', follow these steps:
1. Launch Command Prompt or PowerShell as an Administrator and ask Yes at the UAC prompt.
2. Force Windows to Check for Updates with one of the following commands: *
- UsoClient StartScan
- USOClient.exe StartInteractiveScan
* Note: Some users reported that in their case one command worked and not the other. To see which of the 2 commands works in your case open Windows Update at the same time as running the command to make sure that Windows is checking for updates.
3. After finding Updates, download them with one of the following commands:
- UsoClient StartDownload
4. Proceed to install downloaded updates with this command:
- UsoClient StartInstall
5. When the updates installed, reboot your pc with this command: *
- UsoClient RestartDevice
* Note: I suggest to wait at least 30 minutes before restarting your PC.
Part 2. How to Run Windows Update from PowerShell in Windows 10/11.
If you want to download and install Windows or Drivers updates using PowerShell commands, use the instructions below.
To Install Windows Updates from PowerShell:
1. Open PowerShell as Administrator.
2. Proceed and install the 'PowerShell Windows Update module' with this command and ask Yes (press 'y'), when prompted to install any other provider needed: *
- Install-Module PSWindowsUpdate
1. The 'PSWindowsUpdate' is a necessary module to install updates from PowerShell. To see all the commands available in the module, give this command:
- Get-Command -module PSWindowsUpdate
2. By default the module only look for Windows and driver updates. If you have other Microsoft Products installed (e.g. Office), and you want to get updates for them too, give also this command:
- Add-WUServiceManager -MicrosoftUpdate
3. Then give the following command to allow the execution of scripts on your machine and ask Yes at the warning when prompted.
- Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
4. Now force Windows to download and list all available updates in PowerShell. *
5. Now proceed according to what you want:
A. To install all available Windows Updates from PowerShell give this command:
B. To install all available Windows Updates and the updates for all other Microsoft Products, give this command:
- Install-WindowsUpdate -MicrosoftUpdate
C. To install a specific Windows Update from PowerShell, give this command and ask Yes (y) when prompted: *
- Get-WindowsUpdate -KBArticleID "KB-Number” -Install
e.g. to install the KB5005463 in this example:
- Get-WindowsUpdate -KBArticleID "KB5005463" -Install
D. To prevent a Windows Update from being installed, give this command in PowerShell:
- Get-WindowsUpdate -NotKBArticle “KB-Number” -AcceptAll
e.g. to prevent the installation of the KB5005463 in this example:
- Get-WindowsUpdate -NotKBArticle “KB5005463” -AcceptAll
E. To exclude specific categories from updating, (e.g. the "Driver updates or the Feature updates, give this command:
- Install-WindowsUpdate -NotCategory "Drivers","FeaturePacks" -AcceptAll
Part 3. How to Uninstall Windows Updates from PowerShell.
To remove Updates using PowerShell:
1. Open PowerShell as Administrator.
2. In the PowerShell window, give the following command to get a list of all installed updates.
- wmic qfe list brief /format:table
2. Take note of the KB number associated with the Windows Update you wish to remove.
3. Now execute the following command to remove the desired update in PowerShell:
- wusa /uninstall /kb:Number
Note: Replace ‘Number’ with the KB number of the update you want to remove. For example: to remove the KB5005635 give this command:
- wusa /uninstall /kb:5005635
That's it! Which method worked for you?
Let me know if this guide has helped you by leaving your comment about your experience. Please like and share this guide to help others.
We're looking for part-time or full-time technical writers to join our team! It's about a remote position that qualified tech writers from anywhere in the world can apply. Click here for more details.