Usually, users use the graphical interface on the OS to search for and install updates. However, there are some cases where you may want to run this process from the Command-line (CLI) tools such as Command Prompt and Windows PowerShell.For instance, you may need to manage updates, especially for other users on a Windows server. Or, you may be creating a script where you need such commands.
How to Run Windows Update from Command Line?
There are a few ways to run Windows Update from the command line on a Windows system, which are as follows:
Using Command Prompt
On Windows 10 and 11, Microsoft uses the Update Session Orchestrator Client UsoClient.exe tool for updating your system components.Previously, it was possible for users to use this program from the Command Prompt to check and install updates. However, in the latest versions, you can only check for updates. Regardless, you can try using the steps below and check if they work out for you:You can also check which UsoClient commands you can use on your system by using the following command on the Elevated Windows PowerShell:On older Windows versions, you could use the Windows Update Agent WUAUCLT.exe to update Windows.First, you need to enable Automatic Updates with scheduled installation through the Group Policy. Otherwise using the Windows Update Agent from Command Prompt won’t work. To do so,Then, you can use the following commands on Prompt to update Windows using the Update Agent:
wuauclt /detectnow – Scans for available updateswuauclt /updatenow – Installs the available updateswuauclt /detectnow /updatenow – Combines both the processes above
Microsoft didn’t exactly create the WUAUCLT.exe and UsoClient.exe tools for end users. So you won’t get any additional information for whether the commands are actually running when you use them on the Command Prompt. The Prompt will show that these commands have finished running even when they are still operating in the background.You have to estimate the time it may take and wait until then. So, instead of this method, we recommend using Windows PowerShell as you can get more detailed information during the process.
Using PowerShell
Windows PowerShell is a very powerful Windows CLI with which you can do everything that Command Prompt allows and many more. Naturally, you can use it to run windows updates. Here’s what you need to do:
Using Visual Basic Script
While the above command line methods can run Windows Update, they are not interactive and user-friendly. Microsoft’s platform contains some Visual Basic Script (VB script) to run an interactive update process from the CLI, especially as a sample for developers. However, you can also use this script for your purpose.