If you want to run Windows Update from the command line or PowerShell in Windows 10/11, continue reading below.
Microsoft regularly releases updates to improve security, fix bugs, and introduce new features that improve the functionality of Windows devices.
Windows updates are divided into 2 categories: Quality updates, It is constantly released for security reasons and bug fixes and Feature updates, offers improved versions and additional features.
The usual way to upgrade Windows 10/11 is to switch Settings > Update and security and to check for and install updates, but in some cases you may need to install updates from the command line or PowerShell if the usual method doesn’t work.
This guide contains instructions on how to run Windows Update and how to install or uninstall Updates using the command line and commands in PowerShell.
How to check for and install updates from PowerShell or the command line on Windows 10/11 and Server 2016/2019.
Part 1. How to run Windows Update from the command line.
In earlier versions of Windows, you can update Windows using the command “wuauclt /detectnow /updatenow”.
In the latest versions of Windows 10, the “WUAUCLT.EXE” command no longer works and has been replaced by the “USOCLIENT.EXE” command.
Information: “USOCLIENT.EXE” is the update session orchestrator client used to download and install Windows updates. *
1. According to reports, not all versions of Windows 10 and 11 support 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 while they are running, the only way to determine if a command is running is to look at the following events.
- Task Scheduler -> Microsoft -> Windows -> Update Orchestrator
Follow these steps to install updates with “USOCLIENT.EXE”:
1. Launch Command line or PowerShell as 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 have reported that in their case one command worked and the other did not. To see which of the 2 commands works in your case, open Windows Update at the same time you run it to make sure Windows is checking for updates.
3. When you find updates, download them using one of the following commands:
- UsoClient Download
4. Continue installing the downloaded updates with this command:
5. When the updates are installed, restart your computer with this command: *
*Note: I recommend that you wait at least 30 minutes before restarting your computer.
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. It’s open PowerShell As an administrator.
2. Install and request “PowerShell Windows Update Module” with this command Yes (Click ‘y’), when asked to install another provider that is needed: *
- Installing the PSWindowsUpdate module
1. “PSWindowsUpdate” is a required module for installing updates from PowerShell. To see all commands available in a module, issue the following command:
- Get-Command -module PSWindowsUpdate
2. By default, the module only searches for Windows and driver updates. If you have other Microsoft products (such as Office) installed and want to receive updates for them as well, issue the following command:
- Add-WUServiceManager -MicrosoftUpdate
3. Then issue the following command and ask for permission to run scripts on your computer Yes in the warning when prompted.
- Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
4. Now force Windows to download and list all available updates in PowerShell. *
5. Now proceed as you wish:
A. To install all available Windows updates from PowerShell, issue the following command:
B. To install all available Windows updates and updates for all other Microsoft products, issue the following command:
C. Issue this command and ask to install a specific Windows update from PowerShell Yes (y) when requested: *
- Get-WindowsUpdate -KBArticleID “KB number” – Installation
For example, to install KB5005463 in this example:
- Get-WindowsUpdate -KBArticleID “KB5005463” -Install
D. To prevent Windows Update from installing, issue this command in PowerShell:
- Get-WindowsUpdate -NotKBArticle”KB number” – Accept it all
For example, to prevent installation of KB5005463 in this example:
- Get-WindowsUpdate -NotKBArticle “KB5005463” -Accept all
E. To exclude certain categories from updating (for example, “Driver Updates or Feature Updates”), issue the following command:
- Install-WindowsUpdate -NotCategory “Drivers”,”FeaturePacks” -AcceptAll
Part 3. How to Uninstall Windows Updates from PowerShell
To uninstall updates using PowerShell:
1. It’s open PowerShell As an administrator.
2. In a PowerShell window, issue the following command to get a list of all installed updates.
- wmic qfe list summary / format: table
2. Pay attention to KB number associated with Windows Update that you want to remove.
3. Now run the following command in PowerShell to remove the required update:
- wusa / delete / kb: Number
Note: replace ‘Number‘ with the KB number of the update you want to remove. For example: To remove KB5005635, issue the following command:
- wusa / delete / kb: 5005635
That’s it! Which method worked for you?
Let me know if this guide helped you by leaving a comment about your experience. Please like and share this guide to help others.