# emsntsrg

The `emsntsrg` utility registers or unregisters the EMS server as a Windows service.

## Syntax

    emsntsrg /i [/a]|[/d] service_name emsntsct_directory service_directory [arguments] [suffix]
    emsntsrg /r [service_name] [suffix]

## Remarks

Some situations require the EMS server processes to start automatically. You can satisfy this requirement by registering these with the Windows service manager. This utility facilitates registry.

## Restrictions

You must have administrator privileges to change the Windows registry.

## Location

Locate this utility program as an executable file in the EMS `bin` directory.

Parameter | Description
--- | ---
`/i` | Insert a new service in the registry (that is, register a new service).
`/a` | Automatically start the new service. Optional with `/i`. You can use either `/a` or `/d` but not both.
`/d` | Automatically start the new service with a delay. Optional with `/i`. You can use either `/a` or `/d` but not both.
`/?` | Display usage.
service_name | Insert or remove a service with this base name. When inserting a service, this parameter is required, and must be `tibemsd`. When removing a service, this parameter is optional. However, if it is present, it must be `tibemsd`.
emsntsct_directory | Use this directory pathname to specify the location of the `emsntsct.exe` executable. The `emsntsrg` utility registers the `emsntsct.exe` program as a windows service. The `emsntsct.exe` program then invokes the associated `tibemsd`. By default, `emsntsct.exe` is located in EMS_HOME\bin. This parameter is only required when installing a service.
service_directory | Use this directory pathname to locate the service executable, `tibemsd`. Required.
arguments | Supply command line arguments. Optional with `/i`. Enclose the entire arguments string in double quote characters.
suffix | When registering more than one instance of a service, you can use this suffix to distinguish between them in the Windows services applet. Optional.
`/r` | Remove a service from the registry.

## Register

To register `tibemsd` as a Windows service, run the utility with this command line:

    emsntsrg /i [/a]|[/d] tibemsd emsntsct_directory tibemsd_directory [arguments] [suffix]

- Example 1

  This simple example registers one `tibemsd` service:

      emsntsrg /i tibemsd C:\tibco\ems\8.5\bin C:\tibco\ems\8.5\bin

- Example 2

  This example registers a service with command line arguments:

      emsntsrg /i tibemsd C:\tibco\ems\8.5\bin C:\tibco\ems\8.5\bin "-trace DEFAULT"

- Example 3
  This pair of example commands registers two `tibemsd` services with different configuration files. In this example, the numerical suffix and the configuration directory both reflect the port number that the service uses.

      emsntsrg /i tibemsd C:\tibco\ems\8.5\bin C:\tibco\ems\8.5\bin "-config C:\tibco\ems\8.5\7222\tibemsd.conf" 7222
      emsntsrg /i tibemsd C:\tibco\ems\8.5\bin C:\tibco\ems\8.5\bin "-config C:\tibco\ems\8.5\7223\tibemsd.conf" 7223

  Notice these aspects of this example:

  - When installing `tibemsd`, if you supply a `-config` argument, the service process finds the directory containing the main configuration file (`tibemsd.conf`), and creates all secondary configuration files in that directory. In this example, each service uses a different configuration directory.
  - When you register several EMS services, you must avoid configuration conflicts. For example, two instances of `tibemsd` cannot listen on the same port.

## Remove

To unregister a service, run the utility with this command line:

     emsntsrg /r [service_name] [suffix]

Both parameters are optional. If the service_name is present, it must be `tibemsd`. To supply the suffix parameter, you must also supply the service_name. When both parameters are absent, the utility removes the services named `tibemsd`.

## Command Summary

To view a command line summary, run the utility with this command line:

     emsntsrg

## Windows Services Applet

The Windows services applet displays the name of each registered service. For EMS services, it also displays this additional information:

- The suffix (if you supply one)
- The process ID (PID)—when the service is running

Copyright © Cloud Software Group, Inc. All rights reserved.