The windows Update CLI commands are useful for troubleshooting Windows Update errors. And they are helpful when you need to automate the windows update tasks. In newer versions of windows, the WUAUCLT command has been deprecated and replaced with the usoclient. In this article we have included the options and syntax for using wuault, usoclient, and powershell to detect and install windows updates
WUAUCLT
The windows update command utility in windows is: WUAUCLT. This stands for Windows Update Automatic Update Client. This client has been deprecated in windows 10 and server 2016. Howeve,r it is still available through windows 7 and server 2012R2.
Below is a list of arguments you can pass to the WUAUCLT commands and a short explanation of what each argument does.
Command | Description |
---|---|
/DetectNow | Detect and download updates that are available (will vary by system settings) |
/ReportNow | Tell the client to report its status back to the WSUS server |
/RunHandlerComServer | |
/RunStoreAsComServer | |
/ShowSettingsDialog | Show Windows Update settings dialog |
/ShowWindowsUpdate | Shows the windows update dialog box or web page (depending on windows version) |
/ResetAuthorization | when an update check occurs a cookie is stored that prevents a new update or check for 1 hour. So, you should use this to delete this cookie |
/ResetEulas | Resets the accepted EULA's |
/ShowWU | Shows the windows update dialog on windows vista and above. Opens Windows update on XP |
/SelfUpdateManaged | Scan for windows updates using WSUS |
/SelfUpdateUnmanaged | Triggers a windows update scan using the windows update website |
/ShowOptions | Open the windows update settings window |
/ShowFeaturedOptInDialog | Show Opt-In dialog for featured updates |
/DemoUI | Show the icons for windows update |
/ShowFeaturedUpdates | Open windows update dialog and shows the featured updates |
/ShowWUAutoScan | |
/UpdateNow | Install updates now |
Examples
See below for some examples of running the wuauclt. All examples should be run from an elevated/administrative command prompt
If all you want to do is detect and install updates right now, you would run:
Wuauclt /dectectnow /updatenow
If it is refusing to install, you can run:
Wuauclt /resetauthorization
If you want to have the client report its status back to the WSUS server, you would run:
Wuauclt /reportnow
Powershell
Powershell will give you the most flexibility in installing windows updates. The other methods are fine for simply downloading and installing all updates. However, with the powershell cmdlets you can do things like get a list of updates, search for updates with a specific word in them, then only install those updates.
The first step is to download the powershell module here:
https://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc
If you have Powershell verison 5, you can install the module from the gallery by running:
Install-module PSWindowsUpdate
Before you can run any commands, you need to import the windows update module:
Import-Module PSWindowsUpdate
You might need to install the Microsoft Update service. That can be done with this command:
Add-WUServiceManager -ServiceID 7971f918-a847-4430-9279-4a52d1efe18d
You can get a list of available cmdlets in the PSWindowsUpdate module with the following command:
Get-command -module PSWindowsUpdate
I have also included a list of commands below:
- Add-WUOfflineSync
- Add-WUServiceManager
- Get-WUHistory
- Get-WUInstall
- Get-WUInstallerStatus
- Get-WUList
- Hide-WUUpdate
- Invoke-WUInstall
- Get-WURebootStatus
- Get-WUServiceManager
- Get-WUUninstall
- Remove-WUOfflineSync
- Remove-WUServiceManager
- Update-WUModule
Examples
The most important cmdlet is Get-WUInstall . This will be apparent in the examples below
Download and install updates from Microsoft Update, then reboot:
Get-WUInstall –MicrosoftUpdate –AcceptAll –AutoReboot
**Note, I usually only reboot if required. For that reason, I don’t like to use the AutoReboot flag.
Check if a reboot is required
Get-wurebootstatus
List available updates on Microsoft Update
Get-WUInstall –MicrosoftUpdate –ListOnly
USOClient
The USO client is new to windows 10 and Server 2016. This replaces the wuauclt command in these Operating systems. I would recommend using powershell instead of this client when you are doing automation, since it will work on newer and older clients. However, this client is very simple to use. and is useful for one-off purposes. See the table below for all of the command arguments:
startscan | scan for updates |
---|---|
startdownload | download updates |
startinstall | install updates |
Refreshsettings | Refresh settings if any changes were made |
StartInteractiveScan | Open a dialog and start scanning for updates |
RestartDevice | Restart computer to finish installing updates |
ScanInstallWait | Scan, Download, and install updates |
ResumeUpdate | Resume installing updates on next boot |
Examples
See below for some examples of how to use the USO client. All of these examples should be run in an administrative command prompt
Scan for updates
usoclient startscan
Download updates
Usoclient startdownload
Install updates
usoclient startinstall
Here are other related links
In case you would like to see some additional information, I hae included some links to good resources on these topics:
WSUS Server Cmdlets http://technet.microsoft.com/en-us/library/hh826166.aspx
Powershell Execution Policy:http://technet.microsoft.com/en-us/library/ee176961.aspx
Troubleshoot computers not in WSUS:
http://msmvps.com/blogs/athif/archive/2005/09/04/65174.aspx
Client Side Powershell Module:
http://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc
Powershell FAQ
http://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc/view/Discussions#content