This guide will help you to create a Task Schedule to Shutdown or Restart Windows Server Automatically. First, you have to download PSshutdown from Microsoft. Then create a Task Schedule:
If your schedule doesn't work, you can add one more argument "-accepteula" at the end. Or you just want to restart server then replace "-s" with "-r".