I need to schedule an unattended weekly out of hours download & install of windows updates and then reboot of a Windows Server 2016 box. How can I do this? Can it be done from the command line?
Similar question regarding Windows 2003
Schedule Windows Updates exclusively on a specific work day (and time)?
Best Answer
You should be able to do it via Group Policy, under "Computer Configuration"->"Administrative Templates"->"Windows Components"->"Windows Update", changing the policy setting there.
Alternatively, you can do it by runningwuauclt /detectnow
to check if there are any Microsoft Updates outstanding for installation. Putting that into a scheduled task should give you what you want.Edit: It seems that
wuauclt
no longer works in Windows 10 (and presumably Server 2016). Instead, you can either create a script based on%windir%\System32\en-US\WUA_SearchDownloadInstall.vbs
, which is used bysconfig
, or you can download the script from https://gallery.technet.microsoft.com/scriptcenter/VB-Script-to-Check-and-620579cd and check if it works for you. (Note that the latter will skip any updates that require user input as that won't be possible during an unattended update.)