9.5.3 ServiceCreate (register a service)
- Purpose
-
Registers a service.
- Syntax
ServiceCreate(ServiceInfoName)
- Argument
-
- ServiceInfoName
-
Specify the service information name of the service to be registered. Write a character string or a variable that stores this value.
- Description
-
The ServiceCreate command registers a service in the system, based on the information stored in a service information object.
As a minimum requirement for registering a service, you must set values in the Name, DispName, Type, Start, Errctl, and Path keywords. For details, see 9.5.1 ServiceSetValue (set service information).
The execution result is stored in the _SVC_RTN_ reserved variable. The command returns True on successful execution, or False for all other states.
To register a service, you must log on with an account that has system administrator privileges.
- Note
-
Execute the script file as a user who has administrator permissions. For details, see 1.8.3 Effect of the executing user on command behavior.
- Example
' Register the JP1/Script service if it does not already exist. ServiceSetValue("JSService", Name::"JP1_Script") If IsExistService("JSService") = False Then OutDir = "C:\Program Files (x86)\Hitachi\Script\BIN\" ServiceSetValue("JSService", Name::"JP1_Script" _ , DispName::"JP1/Script" _ , Type::SERVICE_WIN32_OWN_PROCESS _ , Start::SERVICE_AUTO_START _ , Errctl::SERVICE_ERROR_NORMAL _ , Path::OutDir+"SPTHSV.EXE") ServiceCreate("JSService") End
- JP1/Script version
-
Supported from JP1/Script 01-00.