Launching the printer agent as a service using Non-Sucking Service Manager (NSSM)

Before running the print agent as a service, ensure that the nssm.exe file is located in the printer agent folder. Use the nssm.exe (win64) file for 64bit and nssm.exe (win32) file for 32bit.

For Windows services, the service must be run by a service account as the local system will not work. To trigger the Printer Agent Auto Update, the service Name parameter must also be populated.

  1. Open a command prompt and navigate to the folder where the printagent.jar file is located.
  2. Create Windows service by specifying this script in the command prompt:
    nssm.exe install "<SERVICE NAME>" "<JAVA_HOME_LOCATION>\bin\java.exe" "-Xmx512m""-XX:-TieredCompilation" -jar   
      <PRINT_AGENT_LOCATION>\printagent.jar -c<PRINT_AGENT_LOCATION>\<PROPERTIESFILE>
    Note: Adjust the JVM size based on the expected volume of documents needed when running a print agent. For example,
    nssm.exe install "MSCM print agent" "C:\Java\jdk1.8.0_171\bin\java.exe" "-Xmx512m""-XX:-TieredCompilation" -jar C:\printagent  
      \printagent.jar -c C:\printagent\printagent-demo.properties
    

    To delete a service, run this script in the command prompt: nssm remove "<SERVICE NAME>"

  3. Set the application directory by specifying this script in the command prompt:
    nssm.exe set "<SERVICE NAME>" AppDirectory "<PRINT_AGENT_LOCATION>"

    For example, nssm.exe set "MSCM Print Agent" AppDirectory "C:\printagent"

  4. Start the service by specifying this script in the command prompt:
    nssm start "<SERVICE NAME>"
    Note: To validate if the printer agent is running as a service, specify services.msc in the command prompt and locate the created service if it is running.