≡ Menu

How To Run Windows Update From Command Line

In Windows 10, Windows Update can be found in Settings –> Update & Security –> Windows Update. Normally Windows Update keeps on running in the background and will install new updates automatically.

You can also run Windows Update manually to check for new updates at any time. Here are three ways to check for new Windows updates.

Check for Windows updates using Windows Settings

To check for new updates and configure your Windows Update settings, follow the steps below:

  1. Open Windows Settings (Windows key + i).
  2. Choose Update & Security.
  3. Choose Windows Update from the left hand menu.
  4. Press the Check for updates button in the right hand pane.

    Check for updates

    Check for updates

Run Windows Update from PowerShell (Command-line)

There is a PowerShell module for Windows Update. You can install and run the module to check for new updates. There are three steps to running Windows Update through PowerShell. Run the following commands step by step:

  1. Install-Module PSWindowsUpdate
    Install Module PSWindowsUpdate

    Install Module PSWindowsUpdate

    This will install the Windows Update module in PowerShell.

  2. Get-WindowsUpdate
    Get WindowsUpdate

    Get WindowsUpdate

    This command will check for updates.

  3. Install-WindowsUpdate
    Install WindowsUpdate

    Install WindowsUpdate

    This command will install the available updates (which were listed in step 2)

Run Windows Update from Command Prompt (Command-line)

Windows Update can also be run through legacy CMD. The only limitation running Windows Update through the 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 the command prompt does not show any progress, a better approach would be to check and install updates at the same time. 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 do you want to use command line options to run Windows Update?

Also Read:

About the author: Usman Khurshid is a seasoned IT Pro with over 15 years of experience in the IT industry. He has experience in everything from IT support, helpdesk, sysadmin, network admin, and cloud computing. He is also certified in Microsoft Technologies (MCTS and MCSA) and also Cisco Certified Professional in Routing and Switching. Reach him at Twitter @usmank11

{ 14 comments… add one }
  • rich November 3, 2020, 5:28 AM

    Thank you Usman! Wow Microsoft has a new cli USOClient.exe awesome!

  • T. Joy Lee May 24, 2020, 6:25 AM

    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 March 9, 2020, 3:55 PM

    usoclient.exe /StartScan does not update the shown ‘Last checked date’ shown in the GUI on a Windows Server 2016 or 2019.

  • Stig February 24, 2020, 2:12 PM

    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 March 9, 2020, 1:59 AM

      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],
      + FullyQualifiedErrorId : StartServiceFailed,Microsoft.PowerShell.Commands.StartServiceCommand


      • Usman Khurshid March 9, 2020, 3:16 PM

        Please run PowerShell with administrative privileges.

  • StigN February 11, 2020, 1:02 PM

    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 February 21, 2020, 12:41 AM

      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 February 21, 2020, 1:58 AM

        Hi Glenn, thank you for such a detailed explanation.

  • Steve November 3, 2019, 7:44 PM

    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 November 15, 2019, 12:32 AM

      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 September 3, 2019, 7:57 PM

    wuauclt is no longer available with Windows 10.
    You can use usoclient.exe instead.
    Parameters are /StartScan, /StartDownload, /StartInstall

    • Phillip November 12, 2019, 5:39 AM

      Works just fine.

  • Thorsten Sult December 5, 2018, 8:58 PM

    Thank you!

Leave a Comment