You can schedule this using Task Scheduler specifying these values in the Actions tab:Ĭ:\Windows\System32\WindowsPowerShell\v1.0\powershell.exeĬ:\scripts\InstallUpdatesAndRestart.ps1 Y Y I took Gregory’s version and added some additional warnings, modified the restart logic and added an email report which includes a description of the status codes. Please note that I’m not taking credit for all of this – the original script was published by Gregory Strike back in 2011 who adapted it from a VBScript originally created by Microsoft.
I’ve been using this for a few years now on Windows Server 2008 R2 and above without issues. Here’s a PowerShell script that can be used to scan for Windows updates, install them and optionally restart the system automatically.