Open Task Scheduler. Click on Task Scheduler Library. Right click then select “create basic task”.Create Basic Task
Enter the task name and description and click on “next”.
Select the schedule or interval you want then click on “next”.
Select “Start a Program” and click “next”.
In command type “powershell” and for the arguments type “restart-computer” or “restart-computer -force” then click on “next”.
Sometimes it’s necessary to use the ‘SYSTEM’ account to avoid the task process depending on a user account/password. Also, I typically check the box for highest privileges. You’ve created a task to restart your Windows 2012 server. Now you can click on “Finish”.