Skip to main content

Windows Service Installation

This guide explains how to install a TestBench service as a Windows service using NSSM, FireDaemon, YAJSW, or the built-in Windows Task Scheduler.

Service-specific values

Each service's documentation provides the concrete values to substitute for <serviceName>, <serviceDisplayName>, <serviceExecutable>, <servicePort>, and <serviceInstallDir> used in the examples below.


Requirements

  • Installed service: Either the ready-to-use executable (recommended, no Python needed) or a pip install with a .venv — see the service's Installation guide
  • Administrator Privileges: Required for installing and managing Windows services
  • Port Availability: Ensure the desired port is not in use by another application
Executable path vs. Python venv path

The examples throughout this guide use a Python virtual environment path such as .venv\Scripts\<serviceExecutable>. If you installed using the ready-to-use executable, replace this with the direct path to the extracted executable instead, e.g., <serviceInstallDir>\<serviceExecutable>. No .venv folder is involved.


Which Option to Choose?

FeatureNSSMFireDaemonYAJSW
LicenseFree (Public Domain)CommercialFree (Apache License)
GUIYesYesNo
RequirementsNoneNoneJava Runtime
ComplexityLowLowMedium
Best ForMost users, simple & freeEnterprise GUI managementJava environments, cross-platform

Recommendations

  • NSSM: Recommended for most users — free, lightweight, simple to configure, well-documented, and widely used
  • FireDaemon: Choose if you have budget for commercial software and prefer comprehensive GUI-based management with advanced features
  • YAJSW: Choose if you already have Java installed or need cross-platform compatibility (also supports Linux/macOS)

Installation

  1. Open a command prompt (e.g., PowerShell) as Administrator.
  2. Configure the service using one of the following methods:

Method 1: GUI Configuration

  1. Run the command nssm install <serviceName>. The GUI will open automatically.

    NSSM GUI Initial

  2. Configure the following in the Application tab:

    • Path: Path to the service executable e.g., <serviceInstallDir>\.venv\Scripts\<serviceExecutable>
    • Startup directory: Path to the root directory containing configuration files e.g., <serviceInstallDir>\
    • Arguments: Startup parameters e.g., start --port <servicePort>

    NSSM GUI Application Tab Filled

  3. Configure the following in the Details tab:

    • Display name: <serviceDisplayName>
    • Description: Python-based <serviceDisplayName>
    • Startup type: Automatic (Delayed Start)

    NSSM GUI Details Tab Filled

  4. Optional: In the Log On tab, configure the service for specific accounts. Only needed if not using the local system account.

  5. Optional: In the Dependencies tab, configure Windows Service dependencies. Only needed if something must run before the service starts.

  6. Optional: In the Process tab, configure process-related settings such as process priority.

  7. Optional: In the Shutdown tab, specify how the service should handle shutdown.

  8. Configure the following in the Exit actions tab:

    • Restart: Stop Service (oneshot mode)

    NSSM GUI Exit Actions Tab Filled

  9. Configure the following in the I/O tab:

    • Output (stdout): Path to the log file for stdout output
    • Error (stderr): Path to the log file for stderr output

    NSSM GUI IO Tab Filled

  10. Optional: In the File rotation tab, configure log file rotation.

  11. Optional: In the Environment tab, set environment variables for the service.

  12. Optional: In the Hooks tab, define event hooks such as running a command before service start.

  13. After completing all settings, click the "Install Service" button to install the service.

    NSSM GUI Install Service Button

  14. A confirmation dialog should appear upon successful installation.

    NSSM GUI Successful Install

Method 2: CLI Configuration

  1. Install the service directly:

    nssm install <serviceName> "<serviceInstallDir>\.venv\Scripts\<serviceExecutable>" "start --port <servicePort>"
  2. Configure application settings (startup directory):

    nssm set <serviceName> AppDirectory "<serviceInstallDir>"
  3. Configure details settings (display name, description, startup type):

    nssm set <serviceName> DisplayName "<serviceDisplayName>"
    nssm set <serviceName> Description "Python-based <serviceDisplayName>"
    nssm set <serviceName> Start SERVICE_DELAYED_AUTO_START
  4. Configure exit actions (restart behavior):

    nssm set <serviceName> AppExit Default StopService
  5. Configure I/O settings (logging):

    nssm set <serviceName> AppStdout "<serviceInstallDir>\logs\stdout.log"
    nssm set <serviceName> AppStderr "<serviceInstallDir>\logs\stderr.log"
    nssm set <serviceName> AppRotateFiles 1

Managing the Service

  • Start service:
    nssm start <serviceName>
  • Check status:
    nssm status <serviceName>
  • Edit service:
    nssm edit <serviceName>
  • Restart service:
    nssm restart <serviceName>
  • Stop service:
    nssm stop <serviceName>
  • Remove service:
    nssm remove <serviceName>


Option 2: FireDaemon

Installation Steps

  1. Open FireDaemon Pro as Administrator.

    FireDaemon GUI Initial

  2. Click the Plus icon (New) or press Ctrl+N to create a new service.

    FireDaemon GUI New Button FireDaemon GUI New Service

  3. Configure the following in the Program tab:

    Service Identification:
    • Service Name: <serviceName>
    • Display Name: <serviceDisplayName>
    • Custom Prefix String: Enable checkbox and leave field empty
    • Description: Python-based <serviceDisplayName>
    • Startup Type: Automatic (Delayed Start)

    Program to Run as a Service:
    • Program: Path to the service executable e.g., <serviceInstallDir>\.venv\Scripts\<serviceExecutable>
    • Working Directory: Path to the root directory containing configuration files e.g., <serviceInstallDir>\
    • Parameters: Startup parameters e.g., start --port <servicePort>
    • Type: Always Running Program

    FireDaemon GUI Program Tab Filled

  4. Configure the following in the Settings tab:

    General:
    • Show Window: Hidden
    • Job Type: Global

    Logon:
    • Configure if a specific account should run the service.

    FireDaemon GUI Settings Tab Filled

  5. Configure the following in the Lifecycle tab:

    Lifecycle:
    • Upon Program Exit: Stop FireDaemon Service
    • Console Program: True
    • Shutdown By: Ctrl+C or Forceful Termination

    FireDaemon GUI Lifecycle Tab Filled

  6. Configure the following in the Logging tab:

    Output Capture:
    • Capture Stdout in File: Path for stdout logging, e.g., <serviceInstallDir>\windows_service.log
    • Capture Stderr in Stdout: True or specify a separate path for stderr

    FireDaemon GUI Logging Tab Filled

  7. Optional: In the Dependencies tab, configure dependencies to other services.

  8. Optional: In the Environment tab, set environment variables.

  9. Optional: In the Events tab, configure start and termination events.

  10. Configure the following in the Scheduling tab:

    • Overall Launch Delay: e.g., 60 seconds

    FireDaemon GUI Scheduling Tab Filled

  11. Click the checkmark icon to save the settings and close the service definition.

    FireDaemon GUI Save and Close Button

  12. Select the service from the services list and click the Start icon (green play button) to start the service.

    FireDaemon GUI Start Service

  13. The service should now be running.

    FireDaemon GUI Service Running

Managing the Service

First select the service from the services list.

  • Start service: FireDaemon GUI Start Service

  • Stop service: FireDaemon GUI Stop Service

  • Restart service: FireDaemon GUI Restart Service

  • Edit service: FireDaemon GUI Edit Service

  • Remove service: FireDaemon GUI Remove Service



Option 3: YAJSW (Yet Another Java Service Wrapper)

Installation Steps

  1. Requirements:

    • Java Runtime Environment (JRE) installed
    • Administrator privileges
  2. Extract YAJSW into the service directory:

    Download YAJSW and extract it into <serviceInstallDir>\yajsw\.

    The result should look like:

    <serviceInstallDir>\
    yajsw\
    bat\
    conf\
    lib\
    ...
  3. Configure YAJSW:

    Open <serviceInstallDir>\yajsw\conf\wrapper.conf and set the following values:

    # Java executable (adjust path to your Java installation)
    wrapper.java.command=C:/Program Files/Eclipse Adoptium/jdk-21/bin/java.exe

    # Windows Service
    wrapper.ntservice.name=<serviceName>
    wrapper.ntservice.displayname=<serviceDisplayName>
    wrapper.ntservice.description=Python-based <serviceDisplayName>

    # Service paths (forward slashes required by YAJSW)
    wrapper.working.dir=<serviceInstallDir>/
    wrapper.image=<serviceInstallDir>/.venv/Scripts/<serviceExecutable>
    wrapper.app.parameter.1=start
    wrapper.app.parameter.2=--port
    wrapper.app.parameter.3=<servicePort>

    # Logging
    wrapper.logfile=<serviceInstallDir>/logs/yajsw.log
    wrapper.logfile.maxsize=10m
    wrapper.logfile.maxfiles=5
    note

    Use forward slashes (/) in all wrapper.conf paths — YAJSW requires this regardless of platform.

  4. Test the configuration:

    • Open Command Prompt as Administrator
    • Run: <serviceInstallDir>\yajsw\bat\runConsole.bat
    • Verify the service starts without errors, then stop with Ctrl+C
  5. Install and start the service:

    • Open Command Prompt as Administrator
    • Run: <serviceInstallDir>\yajsw\bat\installService.bat
    • Run: <serviceInstallDir>\yajsw\bat\startService.bat

Managing the Service

Open Command Prompt as Administrator:

  • Start service:
    <serviceInstallDir>\yajsw\bat\startService.bat
  • Stop service:
    <serviceInstallDir>\yajsw\bat\stopService.bat
  • Remove service:
    <serviceInstallDir>\yajsw\bat\uninstallService.bat


Autostart with Windows Task Scheduler (Alternative)

The Windows Task Scheduler is a simpler alternative to a registered Windows service. It can launch the service automatically at system startup without installing it as a service.

Setup

  1. Open Task Scheduler (search in the Start menu, or Control Panel → Administrative Tools → Task Scheduler).

  2. In the left pane, select the Task Scheduler Library folder.

  3. In the Actions pane on the right, click Create Basic Task...

  4. Enter a Name (e.g., <serviceDisplayName>) and an optional description → Next

  5. Select When the computer startsNext

  6. Select Start a programNext

  7. Configure the program:

    • Program/script: Full path to <serviceExecutable>, e.g.:
      • Ready-to-use executable: <serviceInstallDir>\<serviceExecutable>
      • Python venv: <serviceInstallDir>\.venv\Scripts\<serviceExecutable>
    • Add arguments: start
    • Start in (optional): The directory containing your config.toml, e.g., <serviceInstallDir>\

    Next

  8. Check "Open the Properties dialog for this task when I click Finish"Finish

  9. In the Properties dialog, configure the following tabs:

    • General: Set security options appropriate for your environment — e.g., "Run whether user is logged on or not" and "Run with highest privileges".
    • Triggers: Select the existing trigger → Edit... → enable Delay task for (e.g., 1 minute) as a startup buffer.
    • Conditions: Check that no unwanted conditions are active — for a server machine, uncheck "Start only if on AC power".
    • Settings: Uncheck "Stop the task if it runs longer than:" — the service is intended to run indefinitely.
info

The service can be stopped via Task Manager or taskkill. Unlike a registered Windows service there is no clean shutdown handling. For production environments, NSSM or FireDaemon are the recommended approach.