The Windows Update allows users to keep Windows OS up to date with the latest security patches, new features, and bug fixes from Microsoft. You can access Windows Update from the Settings app on your PC. You can also run Windows Update from CMD.
Windows Update runs automatically in the background and installs new updates when they are available. However, you can also manually check for updates at any time. This will help you get the latest features and improvements faster.
By checking regularly for new Windows updates, you can ensure your PC is running smoothly and securely, ensuring you are safe from viruses, malware, and other threats.
In this guide, you will learn how to run Windows Update from Command Prompt and PowerShell using different commands.
Table of Contents
Force Windows Update from CMD
Check for updates on all Windows versions
If you want to run Windows Update from Command Prompt, you can use the wuauclt.exe utility. This utility allows you to check for updates, download updates, and install updates from the command line. The only limitation of running Windows Update through the CMD is that it won’t show any progress. Only results are shown when the process is complete. Here is how to run Windows Update from CMD:
Run wuauclt /detectnow to check for new updates and download them
wuauclt /detectnow
Run wuauclt /updatenow to install updates
wuauclt /updatenow
(Optional) Run wuauclt /reportnow to report back to WSUS server (if available)
wuauclt.exe /reportnow
You can also use multiple switches in the same command:
wuauclt /detectnow /updatenow
If you want to disregard the already detected updates and force Windows Update to check for updates again immediately, you may run the following command:
wuauclt /resetauthorization /detectnow
Since the command prompt does not show any progress, a better approach would be to check and install updates simultaneously. Here’s the command for this:
wuauclt /detectnow /updatenow
Check for Windows updates in Windows 11, 10
The above-mentioned command will work in all versions of Windows, including Windows 7 and Windows Server 2008 R2. But if you are using Windows 11, Windows 10 or Windows Server 2016, you can use the “UsoClient” command, which has more options than “wuauclt.” You can run UsoClient with the following switches:
Start checking for new updates
UsoClient /StartScan
Start downloading updates
UsoClient /StartDownload
Start installing updates
UsoClient /StartInstall
Force Windows Update Check using Run Command Box
I found out that the easiest way to force a Windows update check is to use a command in the Run dialog box. There are other commands from CMD and PowerShell as well, but let’s start with the easiest way to do it.
Open the Run Command box (Windows key + R).
Run the following command:
control update
This will trigger the Windows Update graphical user interface which will start checking for new updates. This method works on all versions of Windows including Windows 10 and Windows 11.
There is another command that will trigger the same effect but only works in Windows 10 and 11:
ms-settings:windowsupdate
Run Windows Update from PowerShell
There is no official Windows Update module for PowerShell. However, you can use “PSWindowsUpdate.” PSWindowsUpdate is a third-party module that can be used to configure Windows updates in Windows.
This module is not installed in Windows by default but you can download it from the PowerShell gallery and install and run the module to check for new updates.
Here are the three steps to run Windows Update through PowerShell:
Run the following command to install PSWindowsUpdate:
Install-Module PSWindowsUpdate
Check for available updates by running this cmdlet:
Get-WindowsUpdate
Now install these updates using this cmdlet:
Install-WindowsUpdate
The above-mentioned commands will only install Windows updates. If you want to update other Microsoft products, you’ll also need to enable the Microsoft Update Service. It’s pretty easy to enable it using PowerShell:
Add-WUServiceManager -MicrosoftUpdate
If you want to automatically restart your computer after installing all the updates, you can run the following command instead:
Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -AutoReboot
If you don’t want to install a separate module, you can run the following command to force start Windows Update using PowerShell:
Start-Process -FilePath 'ms-settings:windowsupdate'
Deploy Updates on Remote Computers
The PSWindowsUpdate PowerShell module can also be used to deploy Windows updates on remote computers. There are two commands involved in this process:
Create a list of computers and pass the list as a variable string using the computer names:
$computer = "comp1, comp2, comp3"
You can add more computers to the string separated by commas. Replace “compX” with the name of each computer.
Run the following command to start checking for Windows updates on remote computers:
Invoke-WUJob -ComputerName $computer -Script {ipmo PSWindowsUpdate; Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -AutoReboot} -RunNow -Confirm:$false | Out-File "\server\share\logs\$computer-$(Get-Date -f yyyy-MM-dd)-MSUpdates.log" -Force
Install Specific Updates Only
If you already know the article KB no. of the specific update you want to install, you can run the following command to install that particular update(s) only:
Get-WindowsUpdate - KBArticleID "KB5002324", "KB5002325" -Install
Replace the KB number with the one you want to install.
Prevent Specific Windows Updates from Installing
You can prevent specific updates from installing on your computer by replacing the KB numbers in the following command in PowerShell:
Install-WindowsUpdate -NotKBArticle "KB5002324, KB5002325" -AcceptAll
Check for Windows Updates using Windows Settings
To check for new updates and configure your Windows Update settings, follow the steps below:
Navigate to:
In Windows 11:
Settings app >> Windows Update
In Windows 10:
Settings app >> Update & Security >> Windows Update
Click “Check for updates.”
Force Windows Update to Download Already Downloaded Updates
There will be times when the updates become corrupted or for other reasons, you just don’t want to install the downloaded updates. In that situation, you can easily delete the already-downloaded updates, which will force Windows Update to run again and check for and download the updates again.
The only caveat in this situation is that the update must not have been installed on your computer. If the update is already installed, Windows will detect it as installed and will not download it again. In that case, you will need to uninstall the update first and then force Windows Update to run again.
If you want to force Windows Update to re-download all the updates again, you can do this using the steps below.
Navigate to the following directory using File Explorer:
C:\Windows\SoftwareDistribution\Download
This folder contains all the Windows update files that Windows OS is currently downloading or recently downloaded and installed.
Select and delete all the files from the “Download” folder.
Run Windows Update again using the above-mentioned methods.
This will force Windows Update to check for the same updates and download them again. The download and install process for new updates is completely automated. You don’t need to do anything during the download and installation process.
Manage Windows Updates using Wuinstall
Using WuInstall, IT Administrators can automate Windows updates. Wuinstall can be used to enforce Windows Updates inquiries, downloads, and installations at times when they deem them appropriate, enabling them to make the entire update process more controlled and user-friendly.
WuInstall is a strong and flexible system management tool that can be used in a WSUS-based or standalone environment. To download the latest updates using Wuinstall, you will need to download and install Wuinstall first. Follow the steps below:
Go to http://www.wuinstall.com/ and install the latest free version of Wuinstall on your computer.
Open an elevated Command Prompt.
Run the following cmdlet to search for the latest available Windows updates:
wuinstall /search
This will not only look for new updates but will also list them in the command window.
To download the updates, run the following command:
wuinstall /download
This will download all the available updates from Microsoft servers.
To install the updates, run the following command:
wuinstall /install
There are a few more switches that you can use with the install command:
- /quiet – will install updates without showing anything.
- /disableprompt – Disable any input from Windows.
- /autoaccepteula – Auto-accept any agreement during the update installation.
- /rebootcycle – Install updates on the next computer reboot.
Fix Corrupted Windows Updates
Sometimes Windows Update files get corrupted and the user is not able to download the files again or install the corrupted update files. In that case, we need to run a DISM command to fix the corrupted Windows Update. Here are the steps:
Launch the Command Prompt.
Run the following cmdlet:
dism.exe /Online /Cleanup-image /Restorehealth
After successfully running this command, try force downloading the updates again, and the Windows Update should start working again.
Hopefully, this will be useful in situations where you want to automate certain Windows functions. What other purposes do you want to use command line options to run Windows Update?
Run Windows Update FAQs
What is Windows Update?
Windows Update is a free Microsoft service that provides bug
fixes, security patches, and performance enhancements for Microsoft Windows operating systems. By installing these updates, users can ensure they have the latest features and security available for their operating system.
Can I use the command line to run Windows Update?
Yes, you can use Windows’ command line to run Windows Update.
What is the benefit of running Windows Update from the command line?
Running Windows Update from the command line offers flexibility,
automation, and convenience. For example, by using the command line, you can schedule updates to occur at a specific time or be triggered by an event, and even control which updates are installed.
How can I run Windows Update from the command line in Windows 10?
Follow the steps below to force Windows update with the command line:
Type cmd in the search box, choose Run as administrator, and click Yes to continue.
Type wuauclt.exe /updatenow and hit Enter.
This command will force Windows Update to check for updates and start downloading.
What is the command to run Windows Update from PowerShell?
To run Windows Update via PowerShell, enter the following command:
Start-Process -FilePath ‘ms-settings:windowsupdate’
What is “usoclient.exe” and how does it relate to Windows Update?
“Usoclient.exe” is a built-in command line tool for Windows Update that can be used to scan for updates, start updates, and even uninstall updates. It provides an alternative to Windows Update’s graphical user interface. This tool can be especially useful for IT administrators who need to run Windows Update simultaneously on multiple machines. It can be run from the command line and provides options for updating in managed environments. It also allows for more detailed control over the update process, such as setting which updates to install or uninstall.
Can Windows Update be automated using the command line?
Yes, Windows Update can be automated using the command line. This can be done by creating scripts that automatically execute Windows Update commands.
16 comments
Brett
Nice article. If you want to do the same in an OOBE environment, (pre-logged in/just installed the OS, etc), we use this method all the time (at my job) to update the OS without having to log in to a user account.
1. Press SHIFT+FN+F10 or SHIFT+F10, which usually brings up a CMD prompt, then type and press enter:
start ms-settings:windowsupdate
You can also press WINKEY+E to launch Explorer to access the file system during this part of the set up.
rich
Thank you Usman! Wow Microsoft has a new cli USOClient.exe awesome!
T. Joy Lee
Thank you. Refurbished machine – needed to update in order to move from other machine to “new to me” machine after just getting ti to cooperate with the network. I have never run across a machine that would not update before. The cmd options did not work, but the PS option was exactly what I needed. Added to my bag of tricks. Thank you so much!!
Stig
usoclient.exe /StartScan does not update the shown ‘Last checked date’ shown in the GUI on a Windows Server 2016 or 2019.
Stig
PS C:\> Start-Service wuauserv -Verbose
PS C:\> $updateSession = new-object -com “Microsoft.Update.Session”;$updates=$updateSession.CreateupdateSearcher().Search($criteria).Updates
PS C:\> (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
This is work on a Windows 10 – the Last checked time is updated in the GUI
BUT it’s not workting om Windows 2016 or 2019
Any know of a way to make this work on a Server 2016 ??
Stefan
I don’t get any of these from article to work. Not even: Start-Service wuauserv -Verbose
PS C:\WINDOWS\system32> Start-Service wuauserv -Verbose
VERBOSE: Performing the operation “Start-Service” on target “wuauserv (wuauserv)”.
Start-Service : Failed to start service ‘wuauserv (wuauserv)’.
At line:1 char:1
+ Start-Service wuauserv -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service],
ServiceCommandException
+ FullyQualifiedErrorId : StartServiceFailed,Microsoft.PowerShell.Commands.StartServiceCommand
Halp?
Usman Khurshid
Please run PowerShell with administrative privileges.
StigN
usoclient StartScan does NOT make any changes to the Last checked date shown in the GUI
Neither does the Powershell command Get-WindowsUpdate
In previous Windows I had to updating the Last checked value in registry after performing a scan using the API (as they dont). But MS has moved the location to an unknown place i 2016 and 2019.
Anyone who knows how to update the “Last checked date” from CMD or API ???
Glenn
Function Force-WSUSCheckin($Computer)
{
Invoke-Command -computername $Computer -scriptblock { Start-Service wuauserv -Verbose }
# Have to use psexec with the -s parameter as otherwise we receive an “Access denied” message loading the comobject
$Cmd = ‘$updateSession = new-object -com “Microsoft.Update.Session”;$updates=$updateSession.CreateupdateSearcher().Search($criteria).Updates’
& c:\bin\psexec.exe -s \\$Computer powershell.exe -command $Cmd
Write-host “Waiting 10 seconds for SyncUpdates webservice to complete to add to the wuauserv queue so that it can be reported on”
Start-sleep -seconds 10
Invoke-Command -computername $Computer -scriptblock
{
# Now that the system is told it CAN report in, run every permutation of commands to actually trigger the report in operation
wuauclt /detectnow
(New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
wuauclt /reportnow
c:\windows\system32\UsoClient.exe startscan
}
}
Usman Khurshid
Hi Glenn, thank you for such a detailed explanation.
Steve
It doesn’t work.
Get-WindowsUpdate: The ‘Get-WindowsUpdate’ command was found in the module ‘PSWindowsUpdate’, but the module could
not be loaded. For more information, run ‘Import-Module PSWindowsUpdate’.
At line:1 char:1
+ Get-WindowsUpdate
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-WindowsUpdate:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Matt
To remedy that, please try the following:
1. Run Set-ExecutionPolicy -ExecutionPolicy Unrestricted
2. Run Import-Module PSWindowsUpdate
3. Try running Get-WindowsUpdate again.
This worked for me.
Andi
wuauclt is no longer available with Windows 10.
You can use usoclient.exe instead.
Parameters are /StartScan, /StartDownload, /StartInstall
Justin
“wuauclt is no longer available with Windows 10”
That’s not true at all. I use it all the time to have machines check in.
$updateSession = new-object -com “Microsoft.Update.Session”; $updates = $updateSession.CreateupdateSearcher().Search($criteria).Updates
wuauclt /reportnow
Works 100% of the time. Windows 10 22H2 and Server 2022.
UsoClient on the other hand, no longer works. MS did something to restrict access.
Phillip
Works just fine.
Thorsten Sult
Thank you!