- Expand HKEY_LOCAL_MACHINE > SOFTWARE > Policies > Microsoft > Windows > WindowsUpdate > AU
- Right click and add a the following keys (without the quotes):
"NoAutoUpdate"=dword:00000000
"AUOptions"=dword:00000003
"AllowMUUpdateService"=dword:00000001
"IncludeRecommendedUpdates"=dword:00000001
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
script:
—————————————–
REM Download and Fully Install Windows Updates
usoclient ScanInstallWait
usoclient StartInstall
REM Wait 40 mins to allow all the installs to complete on Windows 10
timeout /T 2400
REM this command will need a local path to the file unless it is run from the same folder that contains it
ShutdownWithUpdates.exe /r /f
_______________________
Or Powershell
Install-Module PSWindowsUpdate
Get-WindowsUpdate
Install-WindowsUpdate