Generic NetPhantom Windows Services

The Generic NetPhantom Windows Services allows NetPhantom Server, Cluster Controller and License Manager to be executed as a Windows Service in the supported Windows operating systems.

The service can be installed several times; the only requirement is that the service name be different. The tools used to do this are included in the Microsoft Resource Kit for Windows and are shipped with NetPhantom for convenience purposes.

Under the server root directory, the subdirectory ntservice contains the required files. A batch file (is.bat) is used to install or uninstall the service(s), and 3 utilities that belong to the Windows Resource Kit (Sc.exe, Srvany.exe and Regini.exe).

A new command line option -ntservice (specified after the start class) enables the following server processes to run as a service:

  • NetPhantom Server,
  • NetPhantom Cluster Controller,
  • NetPhantom License Manager.

This option disables the Logoff signal for the server process that otherwise causes the process to be closed when the console user logs off Windows.

Installing a Windows Service

To install a service, follow the steps below.

  1. Start a command prompt and set the current directory to the server installation root.
  2. Enter the following command:

    ntservice\is INSTALL serviceName program javaDir memory [SERVERVM]

    serviceName is the name of the service to use WITHOUT spaces or quotes.
    javaDir is the base directory for the installation of the Java JDK WITHOUT spaces or quotes.
    memory is the memory size in MB to use for the Java process.
    SERVERVM indicates if the HotSpot Server VM should be used (included with the JDK or better and NOT the JRE). This parameter is optional.

This will create a Windows Service that is manually started at Windows boot when the network has been started (service dependencies to Remote Procedure Call (RPC) and TCP/IP Protocol Driver are added for the service in order to make them work properly when e.g. a server is rebooted).

The service Startup type can be changed from Manual to Automatic by using Services from Administrative Tools in the Control Panel.


The command

ntservice\is INSTALL NetPhantomServer SERVER C:\OpenJDK-11-64bit 750 SERVERVM

will create a service that is run with the command

C:\OpenJDK-11-64bit\bin\java.exe -server -Xrs -Xms750m
-Xmx750m se.entra.phantom.server.Start -ntservice -nteventlog

Note the option -Xrs that reduces signals from the operating system (required when running as a Windows Service).

Note: Do not use spaces in the serviceName or javaDir and do not enclose them within quotes.

Uninstallation of a Windows Service

To uninstall a service, follow the steps below.

  1. Start a command prompt and set the current directory to the server installation root.
  2. Enter the following command:

    ntservice\is UNINSTALL serviceName

    serviceName is the name of the service to use WITHOUT spaces or quotes.

This will remove a previously created Windows Service of the name ServiceName.

Note: Do not use spaces in the serviceName and do not enclose it within quotes.

Registry Keys for a Windows Service

The example below shows the NetPhantomServer NetPhantom Windows Service as an example. This serviceName can be replaced with any valid serviceName specified using the ntservice\is command.

The keys and values below are set when creating the Service NetPhantomServer using the command

ntservice\is INSTALL NetPhantomServer SERVER "C:\OpenJDK-11-64bit" 750 SERVERVM

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ NetPhantomServer:
DependOnService REG_MULTI_SZ RpcSs TcpIp
ErrorControl REG_DWORD 0x00000001
ImagePath REG_EXPAND_SZ C:\Program Files\NetPhantom\ntservice\srvany.exe
ObjectName REG_SZ LocalSystem
Start REG_DWORD 0x00000003
Type REG_DWORD 0x00000010

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ NetPhantomServer\Parameters:
AppDirectory REG_SZ C:\Program Files\NetPhantom
Application REG_SZ C:\OpenJDK-11-64bit\bin\java.exe
AppParameters REG_SZ -Xrs -cp . StartService C:\OpenJDK-11-64bit\jre\bin\java.exe -Xrs -Xms750m -Xmx750m -classpath .;NetPhantomServer.jar;NetRexxR.jar;NetRexxC.jar;bcprov.jar;bcpkix.jar;bcutil.jar;openxml-1.2-np.jar;activator.jar;mail.jar se.entra.phantom.server.Start -ntservice
WaitTime REG_SZ By default this parameter is not present and should be set to the amount of seconds to wait before the service is started. Valid range is 0 to 240 seconds (empty string or not defined equals to zero).

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ Eventlog\Application\NetPhantom Server:
This key is set when the server starts execution with the service name NetPhantom Server.
EventMessageFile REG_EXPAND_SZ C:\Program Files\NetPhantom\WindowsNTEventLog.dll
TypesSupported REG_DWORD 0x00000007

Waiting to start a Windows Service

When a complex IP network topology with NetPhantom License Manager(s) and NetPhantom Servers being load balanced over several physical servers, in conjunction with Microsoft Network Load Balancing included in Windows 2008 Server is used, there are times when a service must be delayed a couple of seconds before it is started when the physical Windows server is booting up.

The SRVANY program provided with NetPhantom supports this in the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ ServiceName\Parameters\WaitTime. This parameter is defined as a REG_SZ entry with the possible values ranging from 0 to 240 seconds (inclusive, empty string equals to zero). A default installation of the service does not create this entry (but the other three AppDirectory, Application and AppParameters are present).