Windows Server 2012R2 – Configure to Reboot Itself After Windows Updates

windows-server-2012-r2windows-update

I have a virtual lab where I manage several 2012R2 servers. On each machine windows update is configured to install updates automatically. I am often not on those machines for weeks at a time. When I do log-in, they almost always are telling me I need to reboot to complete the updates.

How can I configure the servers to just reboot themselves automatically after updates are completed?

There are no shared folders. I do not think there are clients running at night. On some servers SQL Server is installed, but not on most. People can only login via RDP.

Here is a screenshot of all the groups:

enter image description here

EDIT:

I am going to try creating a basic task that will restart the computer every Sunday at 4 am.

How to set up a scheduled reboot

enter image description here

Best Answer

You shouldn't need to use a scheduled task to install Windows Updates.

If your have Active Directory in your virtual lab you can configure Windows Updates using a group policy, and configuring the updates to "Auto download and schedule the install".

If you don't have Active Directory you can do the same as you can using a GPO, but using the local group policy, or editing the registry

Last, but not least if you're set on using a scheduled task, there's a PowerShell module called PSWindowsUpdate which can do the job using

Get-WUInstall -AcceptAll -AutoReboot

If you add that command to a powershell script, and then run your scheduled task using -file as a parameter to powershell.exe in your scheduled task it should install the updates and restart at your desired time.