Skip to content

Instantly share code, notes, and snippets.

@asheroto
Last active December 24, 2024 22:24
Show Gist options
  • Save asheroto/b50ad335b268b58e1083aabdd849b537 to your computer and use it in GitHub Desktop.
Save asheroto/b50ad335b268b58e1083aabdd849b537 to your computer and use it in GitHub Desktop.
Running Ubiquiti UniFi Controller as a Windows Service or on Startup (simply)

Running the UniFi Network Controller as a Windows Service or on Startup

The trick to all methods is to use the java.exe built into the UniFi software, NOT the Adoptium version recommended by Ubiquiti. They are confused. You don't need to install a separate software. You don't need to mess with the JAVA_HOME variable. As long as you specific the commands exactly as shown below, it should work. Tested and confirmed working on a new Windows 11 computer.


Method 1: Using a Traditional Windows Service

  1. Open PowerShell as Administrator.

  2. Navigate to the UniFi installation folder:

    Set-Location "$ENV:USERPROFILE\Ubiquiti UniFi"
  3. Install the UniFi Network Controller as a service:

    .\jre\bin\java.exe -jar lib\ace.jar installsvc
  4. Start the service:

    .\jre\bin\java.exe -jar lib\ace.jar startsvc
  5. Removing the Service (if needed):

    • If the service malfunctions or needs to be reinstalled, uninstall it using:
      .\jre\bin\java.exe -jar lib\ace.jar uninstallsvc

Method 2: Using Task Scheduler

  1. Open Task Scheduler:

    • Option 1: Press Win + R, type taskschd.msc, and press Enter.
    • Option 2: Open the Start menu, type Task Scheduler, and select it from the search results.
  2. Navigate to Task Scheduler Library:

    • In the left-hand panel, go to Task Scheduler (Local) > Task Scheduler Library.
  3. Create a New Task:

    • Click on Create Task… in the right-hand panel, or right-click in the middle panel and select Create New Task….
  4. Configure the New Task:

    • General Tab:
      • Name: UniFi Network Controller
      • Security options: Select Run whether user is logged on or not.
    • Triggers Tab:
      • Begin the task: At startup.
      • Advanced settings: Enable the checkbox for Enabled.
    • Actions Tab:
      • Action: Start a program.
      • Program/script: Browse and set the path to
"%UserProfile%\Ubiquiti UniFi\jre\bin\java.exe"
 - Add arguments:
-jar "%UserProfile%\Ubiquiti UniFi\lib\ace.jar" ui
  • Settings Tab:
    • Enable:
      • Allow task to be run on demand.
      • Run task as soon as possible after a scheduled start is missed.
    • Uncheck all other options.
  1. Test the Task:
    • Restart your system.
    • Once running, wait a few seconds and make sure you can access the UniFi interface:
https://127.0.0.1:8443

By following either of these methods, you can run the UniFi Network Controller as a persistent service on your Windows system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment