How To Schedule Windows Server For Automatic Restart – Server Basics

 

This is one of those really basic tasks you can easily set up with no added software or even Powershell scripts. It’s extremely useful too. Say you need to reboot a server because you installed some software that you didn’t expect needed a reboot, or there’s some updates, or some other reason. You can’t really do it until after hours and you don’t want to hang around and would just like it to reboot itself a couple of hours after closing time when everyone is home.

You might also want to reboot a Windows Server a month or once a week as a matter of routine maintenance.

This is fairly trivial to set up in Task Scheduler.

How To Schedule A Windows Server For Automatic Reboot

Note: I’m using Server 2016. This is almost exactly the same in 2008 and 2012.

Step 1 – Open Task Scheduler. In the newer versions of Windows Server you can just click on the start button and type “Task Scheduler”. You can find it manually under Control Panel under Administrative Tools. You can find it in the Start Menu in Server 2003 but the Task Scheduler is a bit different.

Step 2 – Right Click on the Task Scheduler Library (Highlighted in the picture in Step 1) and click “Create Basic Task”. This will open the Wizard. You don’t have to use the Wizard, but since this is a very simple task it’s easier.

Step 3 – Give a name to the task. I called this “Restart Server Once”. In a multi-server environment, my personal preference is to call it “Restart This Server Once” or “Restart Local Server Once” to show that the task restarts that specific machine. As I usually also have tasks to restart remote servers and workstations on at least one of them as well. If I were also making one to restart the box on a schedule I’d name it something like, “Restart Local Server On First Of Month”.

Click Next.

Step 4 – Since this task is to just restart the server one time click the “One Time” option and then click next.

You’ll note the sub-task called “One Time” under triggers.

Step 5 – Give it a date and time to restart. Click next.

I chose 8pm the next day.

Step 6 – Select “Start A Program”. Click Next.

Step 7 – Type “shutdown” without the quotes into the “Program/Script” box and “/r” into the “Add arguments” box. Click Next.

Step 8 – Click Finish

Step 9 – You aren’t done yet because you want this to run if you get logged off and you want to set this up so you can use it again later.  In the Task Scheduler right-click on your new task and click Properties. This will bring up the general settings page. The radio buttons on the bottom will default to “Run only when user is logged on” change it to “Run whether user is logged on or not”.

Step 10 – Click OK. It will make you enter your administrator password.

You’re finished!

Changing the Schedule for The Automatic Reboot

So now you have a task that will automatically reboot your server (Or PC) one time. Now  you need it to do it again. There’s no need to make another task, you just need to update the trigger.

Step 1 – Go back into Task Scheduler, right-click on your task and click Properties. Click on the Triggers tab.

Step 2 – Click on the “One Time” trigger and click the Edit button. Change the time and date, click OK on all the dialog boxes and your server/PC will now restart at the new time.

It will ask  you to re-enter the administrator password.

How to set up L2TP VPN in Cyberoam

If you need a super easy VPN that can be used without buying a software client like Cisco VPN Client, then L2TP is definitely the way to go. Windows 7, Vista and XP all have a built-in VPN client that can hook up to it. It’s a really good alternative to traditional IPSEC especially for your road warriors.

 L2TP Connection Setup

  1. Log into your Cyberoam and click “VPN” on the left hand side.
  2. Select L2TP and fill in the blanks.
    1. The Local IP address should be the one corresponding to the LAN port on your Cyberoam.
    2. “Assign IP” should be a range of UNUSED IP addresses on your Local Network. I selected a range of 10. For example if 192.168.1.100 through 192.168.1.110 were not used for anything on your network and could be reserved for this, place those IP addresses in these field.
    3. The DNS server blanks should be your internal network DNS servers so that your users can hit your internal servers without IP addresses. Please see the note below on client set up as I’ve run into a couple of issues with this.
    4. You can add a WINS server, but who uses WINS anymore?
  3. Once you’re done there click on save, then click the policy tab.
  4. You can use the Default L2TP policy, I know it works just fine.
    Capture of Cyberoam L2TP settings
  5. Select pre-shared key in the drop down and put in a good strong passkey for your connection. Cyberoam will typically recommend a simple number sequence for testing purposes and to insure you confirmed it correctly on both ends. You can start out with something like “12345678” but please change this after you’ve tested it.
  6. The WAN port should be the internet facing IP address your users will be entering into Windows. Please note that if you don’t have a static IP address for your internet connection, you’ll need to use a dynamic DNS service or configure Cyberoam’s dynamic DNS service.
  7. I usually check the “Allow NAT Traversal” checkbox. This helps if your end users are behind a router somewhere.
  8. Set Remote LAN Network to “Any” as you might not know how the other end’s network is set up.
  9. Leave remote ID like it is.
  10. Leave the Quick Mode Selecters as default (it should look like the picture above), unless you know you need a different port.
  11. Click Save, and activate the connection.

L2TP users

I like using Active Directory Integration anywhere I can but for some reason the Cyberoam doesn’t like LDAP users authenticating to it over VPN. I might have a setting wrong, but I’ve never gotten this to work right anywhere I’ve installed one. If  you have LDAP/AD integration set up, you’ll just need to add extra users in the Cyberoam for L2TP access. If you imported all your users manually then you can just go into users you want to give access and select the L2TP enable box.

Setting Up Windows VPN

I assume Windows 7 for this. Vista directions are almost identical, XP should be easy to figure out. I would imagine Windows 8 uses the same basic wizard as Vista/7.

  1. Go into your network and sharing center and click “Set up a new connection or network”.
  2. Select “Connect to a Workplace” in the next window. Click Next.
  3. Select “Use my Internet Connection (VPN)”
  4. Type in the IP address you selected in step 6 when you set up the L2TP connection on the Cyberoam. You can also put a DNS name here if you want (Like if you use dynamic DNS or have a DNS record set up on the internet for this IP). Name the Destination. I also will typically select the “Allow other people to use this connection” if multiple usernames will be used on the target computer. Click Next.
  5. Put the username and password in on the next window. These are the Cyberoam user names. Again if you use LDAP you may or may not be able to use your normal Windows login credentials here. I typically don’t send the Domain if I set up Cyberoam specific usernames for this. Click Next.
  6. It will attempt to connect, but you want to skip that because you need to enter a pre-shared key into the Windows settings.
  7. Go back into Network and Sharing Center and click on “Change Adapter Settings”.
  8. You’ll see the VPN connection you just set up here. Right click on it and hit properties.
  9. Everything on the General Tab should be fine. Click on the Options tab. I typically uncheck “Send Windows Domain” since you are logging in with a Cyberoam account. Click on PPP Settings and make sure the bottom two boxes are unchecked.
  10. Click on the Security Tab. Change “Type of VPN” at the top to “L2TP”, this will save a LOT of login wait time. Click the Advanced button under the drop down and select “Use preshared key for authentication”. Enter the same key you put into the Cyberoam in step 5.
  11. Under Data encryption I will select “Optional Encryption” for testing purposes. Required encryption works fine though.
  12. Select “Unencrypted password (PAP)” under the allowed protocols. I usually just do this to test the connection, I take it off for production.
  13. Click the Networking tab. It’s a good idea to manually enter the DNS servers under the IP4 properties. For some reason the DNS servers aren’t always transmitted to the client.
  14. Click OK.

You should be able to connect just fine. Remember you’ll need to test this outside your own LAN. The only problem I’ve had with this method is that the connection occasionally needs to be reset by de-activating and re-activating it under the L2TP connections tab in the Cyberoam. I wouldn’t use this for more than a few users.

The main reason you won’t be able to connect is if you typed the pre-shared key incorrectly. The second reason is usually an incorrect user/password combination. The third biggest reason is the connection needs to be reset as mentioned above. Also I’ve never been able to get more than one remote user per site to be able to connect successfully. So don’t do this and send teams of people to one place on a shared internet connection and expect them all to be able to connect.