Setup Minecraft server to start automatically

Minecraft

These instructions will allow setting up Minecraft server to launch automatically when computer starts. I used Windows 8.1 Pro machine, but setting this up on different Windows versions would be very similar.

  • First of all setup Minecraft server and make sure you can launch it manually.
  • You could skip this step and use an existing admin account (with password enabled), but it’s best security practice not to give any service more permissions than it requires.
    • Create a new non-admin user account minecraft with secure password. Set password to never expire.
      New user account
    • To run scheduled task, our account will need Log on as batch job right:
      • Open Local Security Policy
      • Navigate to Local Policies > User Rights Assignment
      • Find and open policy Log on as a batch job
      • Click on Add User or Group and add your new minecraft account.
        Local Security Policy
  • Create a scheduled task:
    • Open Task Scheduler and create a new task. Setup it up in a following way:
    • General tab
      • Click on Change User and Group and select account you created in the previous step
      • Select Run whether user is logged on or not
        Task Scheduler - General Tab
    • Triggers tab
      • Click New and create a trigger
      • Under Begin the task: select At startup
      • Make sure Enabled is checked and click OK
        Task Scheduler - Triggers Tab
    • Actions tab
      • Click New and create a new Start a Program type action
      • In Program/script field enter:
        java
      • In Add argument field enter your Minecraft server launch commands (as you would do in .bat file when starting the serve manually). I.e:
        -Xms1024M -Xmx1024M -jar “C:\DATA\minecraft_server\minecraft_server.jar” nogui
        In this particular case we are assigning 1024MB RAM to the server. Path to the server file is in quotes, and nogui tells to launch server without GUI.
      • In Start in field enter path to the directory where your server java file resides, i.e:
        C:\DATA\minecraft_server
        Task Scheduler - Actions Tab
    • Conditions tab
      • Clear all checkboxes
        Task Scheduler - Conditions Tab
    • Settings tab
      • Check Allow task to be run on demand 
      • In the drop down under If the task is already running, then the following rule applies: select Do not start a new instance
        Task Scheduler - Settings Tab
    • Now just click OK to save all changes. You will be prompted to enter your minecraft user account password.

That should be it. First run the task manually and make sure it stays running and your Minecraft server is accessible. Then restart the computer and Minecraft server should launch automatically without you even having to log-on with your user account.

If you let your computer to go into sleep mode and find that sometimes Minecraft server crashes after resuming from sleep, read this.

Windows 8.1 Pro 64bit
Minecraft Server 1.8


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *