how-to, microsoft, windows, microsoft

It’s always recommended to regularly update Windows as the updates solve any existing bugs and bring about new features.

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:

  1. Open Run by pressing Win + R.
  2. Type cmd and press Ctrl + Shift + Enter to open the Elevated Command Prompt.
    how-to, microsoft, windows, microsoft
  3. Enter the following commands depending on the corresponding operations:
    • UsoClient StartScan – Start the scan for available updates
    • UsoClient StartDownload – Download but not install the updates or patches you scanned for.
    • UsoClient StartInstall – Install all downloaded updates.
    • UsoClient ScanInstallWait – Scans, downloads, and installs the updates
    • UsoClient RestartDevice – Restarts your computer to complete the update installation
    • UsoClient ResumeUpdate – Resumes the installation of update after reboot
    • UsoClient RefreshSettings – Refresh the update settings to the default
      how-to, microsoft, windows, microsoft

You can also check which UsoClient commands you can use on your system by using the following command on the Elevated Windows PowerShell:

  1. Open Run.
  2. Type powershell and press Ctrl + Shift + Enter to open the Elevated Windows PowerShell.
  3. Copy and paste the following command and press Enter:
    Get-ScheduledTask -TaskPath 'MicrosoftWindowsUpdateOrchestrator' | Select-Object @{Expression={$_.TaskName};Label="TaskName"}, @{Expression={$_.Actions.Execute + ' ' + $_.Actions.Arguments};Label="CommandLine"}
    how-to, microsoft, windows, microsoft

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,

  1. Open Run and enter gpedit.msc to open the Local Group Policy Editor.
  2. Go to Computer Configuration > Administrative Templates > Windows Components > Windows Update.
  3. If it doesn’t contain policies but expands to further folders, go to Manage end user experience.
    how-to, microsoft, windows, microsoft
  4. Double-click on Configure Automatic Updates.
    how-to, microsoft, windows, microsoft
  5. Check Enabled and set Configuring automatic updating to 4 – Auto download and schedule the install.
  6. You can choose any schedule you want. Then, click Apply and OK.
    how-to, microsoft, windows, microsoft

Then, you can use the following commands on Prompt to update Windows using the Update Agent:

  • wuauclt /detectnow – Scans for available updates
  • wuauclt /updatenow – Installs the available updates
  • wuauclt /detectnow /updatenow – Combines both the processes above
    how-to, microsoft, windows, microsoft

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:

  1. Press Win + R to open Run.
  2. Type powershell and press Ctrl + Shift + Enter to open the Elevated PowerShell. If you use PowerShell 7, you can open it by entering pwsh instead of powershell
  3. Enter the command below to download and install the Windows Update Module, which you need to run the actual commands for updating Windows:
    Install-Module PSWindowsUpdate
    how-to, microsoft, windows, microsoft
  4. On the prompts, type Y and press Enter.
  5. After installing it, enter the following update commands to perform the corresponding actions:
    • Get-WindowsUpdate – Scans for available updates and displays them
    • Install-WindowsUpdate – Downloads and installs all the available updates
    • Get-WindowsUpdate -AcceptAll -Install -AutoReboot – Downloads and installs all the available updates while automatically rebooting the PC after the installation if necessary.
    • Get-WindowsUpdate -Install -KBArticleID 'KB5017859' – Install the KB5017859 update. You need to replace the update ID ‘KB5017859’ with the KB Article ID of the available updates from the Get-WindowsUpdate command.
      how-to, microsoft, windows, microsoft

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.

  1. Open Run and enter notepad to launch this text editor.
    how-to, microsoft, windows, microsoft
  2. Then, open a web browser and go to the following Microsoft pages depending on whether you want to install a particular update or all updates at once:
    • All Available Updates
    • Specific Updates
  3. Copy the script from the page to the notepad you just opened.
  4. Press Ctrl + S to save the file.
  5. Set Save as type to All files and File name to UpdateInstall.vbs. You can use any name, but remember to use the .vbs extension.
  6. Save it on any location by navigating there and clicking on Save.
    how-to, microsoft, windows, microsoft
  7. Then, open the Elevated Command Prompt.
  8. Enter the following command while replacing the path:
    cscript “UpdateInstall.vbs”
    how-to, microsoft, windows, microsoft
  9. You can also right-click on the script on your file explorer and select Copy as path. Then, paste it after typing cscript and the space to avoid manually typing the full path.
  10. Then, follow the on-screen instructions on the CLI.

TECH NEWS RELATED

All The Game Awards Winners Revealed

The Game Awards is honoring some of the best games of 2022.

View more: All The Game Awards Winners Revealed

Dead Cells Is Getting A Castlevania Crossover DLC

Return To Castlevania launches early next year.

View more: Dead Cells Is Getting A Castlevania Crossover DLC

The Game Awards: We Used Data to Predict the Winners

The Game Awards 2022 are just one day away, and one of the big discussions every year surrounds which game will win the final award of the night: Game of the Year. This year, the nominees are A Plague Tale: Requiem, Elden Ring, God of War Ragnarok, Horizon Forbidden West, ...

View more: The Game Awards: We Used Data to Predict the Winners

PS5's Returnal Officially Coming To PC In 2023

After several rumors and listings, PlayStation has announced that Returnal is coming to PC in 2023.

View more: PS5's Returnal Officially Coming To PC In 2023

Get 10 PC Games For Only $5, Including A Bunch Of Great Steam Deck Titles

Customize your bundle with indies like Surgeon Simulator, Retrowave, Alwa's Awakening, and more.

View more: Get 10 PC Games For Only $5, Including A Bunch Of Great Steam Deck Titles

Vampire Survivors, One Of The Best Games Of 2022, Surprise-Releases On iOS And Android For Free

The hit roguelite survival game is easier to play than ever before.

View more: Vampire Survivors, One Of The Best Games Of 2022, Surprise-Releases On iOS And Android For Free

This Portable Xbox Series S Monitor Is On Sale For A Big Discount At Amazon

The tiny screen turns your Series S into an all-in-one gaming setup you can carry anywhere.

View more: This Portable Xbox Series S Monitor Is On Sale For A Big Discount At Amazon

Bend Studio Distances Itself From Former Director After Twitter Rant About Critical Reception

Days Gone developer says it doesn’t share John Garvin’s view on why it was poorly received. A statement from Bend Studios on Twitter has addressed the recent outburst from the Days Gone director, who blamed “woke reviewers” for its critical reception. “We are aware of the comments made by our previous Creative Director ...

View more: Bend Studio Distances Itself From Former Director After Twitter Rant About Critical Reception

Microsoft Authenticator for iOS Now Complies with FIPS 140 Standard

Vampire Survivors, One Of The Best Games Of 2022, Surprise-Releases On iOS And Android

Why Microsoft Is Being Sued | GameSpot News

Tiny Glade, A "Castle Doodling" Building Game, Finally Gets A Trailer

Microsoft Flight Simulator Bergen & Rodez–Aveyron Airports Announced

Reviewing Microsoft's rough security year in 2022

2023 Cupra Formentor VZ review

Consumer Reports Tips on How to Spot Hidden Damage When Buying a Used Car

Apple to allow Mac and iPhone owners in Europe to repair their own devices

Web skimming hackers infiltrate over 40 ecommerce websites - that we know of

Samsung confirms it wants GDDR7 RAM to reach 36Gbps with PAM-3 signaling

Xiaomi 13 series will feature Nano Skin technology

OTHER TECH NEWS

Top Car News Car News