Recently we discussed about stopping a specific update from installing in Windows 10. In this post, we will run Windows Update through command line. This is just a quick post on how to run Windows Update using command line tools in Windows. Sometimes it becomes important to run Windows Update from command prompt and install updates accordingly.
Run Windows Update using PowerShell
There is a PowerShell module for Windows Update. You can install and run the module to check for new updates. There are three steps for running Windows Update through PowerShell. Running the following commands step by step:
- Install-Module PSWindowsUpdate
Install Module PSWindowsUpdate
This will install the Windows Update module in PowerShell.
- Get-WindowsUpdate
Get WindowsUpdate
This command will check for updates.
- Install-WindowsUpdate
Install WindowsUpdate
This command will install the available updates (which were listed in step 2)
Run Windows Update using command line
Windows Update can also be run through legacy CMD. The only limitation running Windows Update through command prompt is that it won’t show any progress. Only results are shown. Let’s see how to run it:
- Go to Run –> cmd
- Run the following command to check for new updates:
wuauclt /detectnow - Run the following command to install new updates
wuauclt /updatenow
Since command prompt does not show any progress, a better approach would be to check and install updates at the same. Here’s the command for this:
wuauclt /detectnow /updatenow
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 10 or Windows Server 2016, you can use UsoClient command which has more options than wuauclt. You can run UsoClient with the following switches:
StartScan – Start checking for updates
StartDownload – Start downloading updates
StartInstall – Start installing downloaded updates
RestartDevice – Restart Windows after updates are installed
ScanInstallWait – Check for updates, download available updates and install them
Hopefully this will be useful in situations where you want to automate certain Windows functions. What other purposes you want to use command line options for running Windows Update?
Interesting Reads Next:
- 4 Ways To View And Save List Of Updates Installed On Windows 10
- How To Download Any Windows 10 Cumulative Update
- How To Stop A Specific Update From Installing In Windows 10
- Check If a Remote Network Port Is Open Using Command Line
- 4 Ways To Enable/Disable Optional Windows Features
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
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.
wuauclt is no longer available with Windows 10.
You can use usoclient.exe instead.
Parameters are /StartScan, /StartDownload, /StartInstall
Works just fine.
Thank you!