INSTALLXML command

The INSTALLXML command allows you to install application as service with parameters specified in a separate XML file.

Syntax:

APP2SRV INSTALXML /XML=name
       [/RUSR=user /RHOST=name/IP /RPWD=password]
Parameter Description
FILE.XML Required parameter which is the full path to XML file.
RHOST Optional parameter that is the remote computer’s name or IP.
This parameter is applicable only together with RUSR and RPWD parameters. For OEM License owners only.
RUSR Optional parameter that is the administrator account name under which you want to login to the remote computer. This parameter is applicable only together with RHOST and RPWD parameters. For OEM License owners only.
RPWD Optional parameter that is the remote account password. This parameter is applicable only together with RHOST and RUSR parameters. For OEM License owners only.

This file may contain the following tags:

Tag Description
Program Defines the major service settings and includes the following sub tags: ServiceName, Display, Description, WorkDir, Executable, Parameters, ConsoleApplication.
ServiceName Required tag that is the valid name of the service you want to install.
Display Optional tag which is shown in Windows Service Control Manager (SCM) in the "Name" column. Its value may contain whitespaces. If this value is not specified, ServiceName is used instead.
Description Optional tag that sets more descriptive information for the service and is displayed in SCM. Note: whitespaces (such as spaces, tabs and punctuation) are not allowed. If this value is not specified, Display is used instead.
WorkDir Optional tag that defines the working directory of the service. If the folder is located on the remote host, specify the valid Universal/Uniform Naming Convention (UNC) path to the network drive ("//servername/full/path").
Executable Required tag that specifies the executable file which should be run as service.
Parameters This is an optional list of parameters that can be passed to the executable at the start time. It may contain username, system or service specific environment variables (for instance, %MYVAR%), file name and so on.
ConsoleApplication Optional tag that defines whether the application you run as service is a console one. Supply "TRUE" if this is console application and "FALSE" otherwise. If this parameter is not specified, it is assumed that the application is not console.
Settings Defines a number of service options and includes the following sub tags: Order, Account, Password, StartType, InteractDesktop, ShowWindow, UponProgramExit, UponProgramExitTime, FlapDetection, FlapDetectionRetries, GracefulShutdown, StopCommand, ShutdownTime.
Order Optional tag that defines the name of the Load Order Group which the application you want to launch as service will belong to.
Account Optional tag that defines account name under which the service will run. As the result, the application you launch as service will have exactly the same execution rights, which is useful if you want to restrict or grant your application certain privileges. If the parameter is not specified, the service will run with rights under which Application as Service was launched.
Password Optional tag that defines the password to the account specified by Account parameter.
SessionId Optional tag that defines the session ID for the interactive service launch. If the required session is unavailable, the default one (zero) will be used.
StartType Optional tag that defines the start-up type of the service. Its value can be: "Manual", "Automatic" or "Disabled". "Manual" type means that this service can be started at any time manually by the user, "Automatic" means that the service will be started automatically by Service Control Manager prior to login session and, finally, "Disabled" type means that the service is not started unless you change its status to something else. "Disabled" is useful if you want certain service be present but not running. The default value is "Manual".
InteractDesktop Optional tag that defines whether the application which is run as service should be interactive – "Default", should be launched in Winlogon screen – "Winlogon", or not interactive – "NONE". By default the service is not interactive.
ShowWindow Optional tag that defines the display mode of the service and is applicable to interactive services only. It may have one of the following values: "Normal", "Hidden", "Minimized" and "Maximized".
UponProgramExit Optional tag that defines the service behavior on termination of the application, which is run as service. It may have the following values: "Disable", "Restart the program after" and "Shutdown the service".
UponProgramExitTime Optional tag that defines the period of time (in seconds) between attempts to relaunch the application, and is applicable if you use it with UponProgramExit set to "Restart the program after".
FlapDetection Optional tag that defines how Service Control Manager should manage the service in case the application, which is run as service, terminates several times in succession. It may have the following values: "Disable" and "Shutdown the service after" (will terminate the  service by sending "Stop" command). This parameter is applicable if UponProgramExit tag is set to "Restart the program after".
FlapDetectionRetries Optional tag that defines how many attempts to restart the application should be made before the Flap detection is enabled. This parameter is applicable if UponProgramExit tag is set to "Restart the program after".
GracefulShutdown Optional tag that defines whether the graceful shutdown is enabled. Set this parameter to "TRUE" if graceful shutdown is enabled, and "FALSE" otherwise. Graceful shutdown ensures that the application, running as service, terminates correctly.
StopCommand If GracefulShutdown is enabled, you can use this tag to stop console program.
ShutdownTime Optional tag that defines the period of time (in seconds) before the application is forced to exit (in case it is not responding).
Advanced Defines a variety of additional advanced service options and includes the following sub tags: Stdin, Stdout, Priority, CpuMask.
Stdin Optional tag that defines the name of the file from which STDIN (standard input) stream will be redirected.
Stdout Optional tag that defines the name of the file where STDOUT (standard output) and STDERROR (standard error) streams will be redirected to.
OverwriteOut Optional tag that defines whether the output file should be overwritten at each service start.
By default this option is disabled. OWR=1 means that it is enabled.
Priority Optional tag that defines the priority value of the process. It may have one of the following values: "Low" priority is used for the processes that run in the background; "Normal" priority is used for the processes without special scheduling needs, "Below Normal" priority is used for the processes of above Low priority but below Normal priority types. Not available for Windows 95/98/Me and NT. "Above Normal" priority is used for the processes of above Normal priority but below High priority types. Not available for Windows 95/98/Me and NT. "High" priority is used for time-critical tasks that must be executed immediately. "Real Time" is the highest priority possible.
CpuMask Optional tag that defines processor/processors that can be used by the service and is applicable to multi-processor systems only. The value is the sum of the processors where the first CPU is 0, the second is 2, the third is 4, the fourth – 8, the fifth – 16, the sixth – 32, the seventh – 64, and the eighth – 128.
Dependencies Defines the services to be launched and stopped in the specific order and includes the following sub tag: Dependence.
Dependence Optional tag that defines group/groups which the service will depend upon. It must match the Service Name of the pre-existing service, otherwise the service will not start. If the certain group of services is not started you will be sent a warning message.
Environment Defines which environment variables should be initialized on the service start and be accessible from within this service, and includes the following sub tag: Variable.
Variable Environment variable that will be initialized at the service start and be accessible from within this service.
Recovery Defines the system’s behavior on the service crash or faults and includes the following sub tags: ResetFailCount, RunProgram, Message, Type, Delay.
ResetFailCount Optional tag that defines the time (in hours) after which Application as Service should reset the failure count to zero if no failures occurred. Specify "-1" to indicate that this value should never be reset.
RunProgram Optional tag that defines the additional command-line executable that should be run on the application crash. This is applicable if Action parameter is equal to "Run a program".
Message Optional tag that sets the broadcast message which will be sent to all logged users on the server reboot. This parameter is applicable if Action is equal to "Reboot computer".
Type Optional tag that sets the action that should be taken if the application that runs as service is abruptly terminated. It consists of two parameters separated by a vertical line. The first one may have one of the following values: "take no action", "restart the service", "restart computer", "run a program". The second parameter sets the delay in minutes before the recovery action is taken.
Delay Optional tag that sets the delay in seconds before the recovery action is taken.
Pre-service Optional tag that sets the additional application that should be launched prior to the service. The value is the string of parameters separated from each other by a vertical line. Those parameters are: Executable (the full path and name of the pre-service program), Working Directory (the full valid path to the working directory of the pre-service program), Parameters (the list of parameters that can be passed to the pre-service program), Execution Time (expected time to run the pre-service program).
Post-service Optional tag that defines the additional application that should be launched once the service is stopped. The value is the string of parameters separated from each other by a vertical line. Those parameters are: Executable (the full path and name of the post-service program), Working Directory (the full valid path to the working directory of the post-service program), Parameters (the list of parameters that can be passed to the post-service program) and Execution Time (expected time to run the post-service program).
Pre-run-program Optional tag that defines the additional application that should be launched before the command to start the application, which is launched as service, is executed. The value is the string of parameters separated from each other by a vertical line. Those parameters are: Executable (the full path and name of the pre-run program), Working Directory (the full valid path to the working directory of the pre-run program), Parameters (the list of parameters that can be passed to the pre-run program), Execution Time (expected time to run the pre-run program).
Post-run-program Optional tag that defines the additional application that should be started immediately after the command to start application, which is launched as service, is executed. The value is the string of parameters separated from each other by a vertical line. Those parameters are: Executable (the full path and name of the post-run program), Working Directory (the full valid path to the working directory of the post-run program), Parameters (the list of parameters that can be passed to the post-run program), Execution Time (expected time to run the post-run program).
Pre-stop-program Optional tag that defines the additional application that should be started every time before the command to stop application, which is launched as service, is executed. The value is the string of parameters separated from each other by a vertical line. Those parameters are: Executable (the full path and name of the pre-stop program), Working Directory (the full valid path to the working directory of the pre-stop program), Parameters (the list of parameters that can be passed to the pre-stop program), Execution Time (expected time to run the pre-stop program).
Post-stop-program Optional tag that defines the additional application that should be started immediately after the command to stop the application, which is launched as service, is executed. The value is the string of parameters separated from each other by a vertical line. Those parameters are: Executable (the full path and name of the post-stop program), Working Directory (the full valid path to the working directory of the post-stop program), Parameters (the list of parameters that can be passed to the post-stop program), Execution Time (expected time to run the post-stop program).
Post-start-window This tag defines managing of various pop-up windows after your application is launched. It includes the following tags: Parent-caption – defines caption text of the parent window, which will be searched for to execute "Close window" or "Press button" commands; Parent-class – defines Windows system class name of the parent window; Caption – optional parameter that defines the caption text of the window, which will be searched for to execute certain commands. Note, that button is related to window as well, for example, if you want to press button "YES" of some window you should write "&YES"; Class – defines Windows system class name of the window; Wait – defines time after which the command to close window or press button will be executed; Command – defines what command to send: 1 – "Press button" or 0 – "Close window" when you use Post-start-window tag.
Pre-send-exit-window This tag defines closure of various pop-up windows before your application is closed. It includes the following tags: Parent-caption – defines caption text of the parent window, which will be searched  for to execute "Close window" or "Press button" commands; Parent-class – defines Windows system class name of the parent window; Caption – optional parameter that defines the caption text of the window, which will be searched for to execute certain commands. Note, that button is related to window as well, for example, if you want to press button "YES" of some window you should write "&YES"; Class – defines Windows system class name of the window; Wait – defines time after which the command to close window or press button will be executed; Command – defines what command to send: 1 – "Press button" or 0 – "Close window".
Post-send-exit-window This tag defines closure of various pop-up windows after sending WM_CLOSE to your application. It includes the following tags: Parent-captiondefines caption text of the parent window, which will be searched for to execute "Close window" or "Press button" commands; Parent-classdefines Windows system class name of the parent window; Captionoptional parameter that defines the caption text of the window, which will be searched for to execute certain commands. Note, that button is related to window as well, for example, if you want to press button "YES" of some window you should write "&YES"; Class – defines Windows system class name of the window; Waitdefines time after which the command to close window or press button will be executed; Command – defines what command to send: 1 – "Press button" or 0 – "Close window".
Schedule Defines running of your application (either periodically on just once) at the particular time of the day, on the specific day of the week or on the particular date and includes the following sub tags: TimeStart, TimeStartEnd, TimeStop, DateStart, DateStop, RunDays, MonthFrom, MonthTo, MonthDay.
TimeStart This is a 24-hour formatted time string that defines the start time of your application. For instance, 13:00:00 means that your application, which is launched as service, should be started at 1 PM local time.
TimeStartEnd This is a 24-hour formatted time string that is active when TimeStart parameter is used only and defines the end time, in other words, your application should start till that time.
TimeStop This is a 24-hour formatted time string that defines the stop time of your application which is launched as service. For instance, 14:00:00 means that the application should be stopped at 2 PM local time.
DateStart Your application, which is launched as service, will be started or stopped every day at the specified time starting from this date. The first 2 digits represent the day of the month, followed by 2 digits representing the month of the year and, finally, the last 4 digits is the year. For instance, 08:11:2008 means that the application should run or stop every day at the specified time starting from the 8th of November, 2008.
DateStop Your application, which is launched as service, will be started or stopped every day at the specified time until this date. The first 2 digits represent the day of the month, followed by 2 digits representing the month of the year and, finally, the last 4 digits is the year. For instance, 16:11:2008 means that the application should be started or stopped every day at the specified time until the 16th of November, 2008.
RunDays Defines the number of days your application should run or stop.
MonthFrom Defines the starting day of the month when your application should be started or stopped.
MonthTo Defines the day of the month till which your application should be started or stopped and should be used with MonthFrom tag only.
MonthDay Defines the certain day of the month when your application should be started or stopped.

Return value:
0 – if the command succeeds. Otherwise "-1" or the error code is returned.