9.5.9 ServiceChange (change a setting for a service)
- Purpose
-
Changes the information set for a service.
- Syntax
ServiceChange(ServiceInfoName)
- Argument
-
- ServiceInfoName
-
Specify the name of the service information in which the changes are stored. Write a character string or a variable that stores this value.
- Description
-
The ServiceChange command changes a setting in the service information for the current service.
The execution result is stored in the _SVC_RTN_ reserved variable. The command returns True on successful execution, or False for all other states.
- 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
' Change the setting (startup type) for the JP1/Script ' service. Dim svStart ' Set JP1/Script for "JSService" service information. ServiceSetValue("JSService", Name::"JP1_Script") ' Get the settings for "JSService" service information. ServiceQuery("JSService") ' Get the setting (startup type) stored in "JSService" service ' information, and store it in the variable. ServiceGetValue("JSService", Start::svStart) ' If the startup type of the service is automatic startup, ' Change it to manual startup. If svStart = 3 Or svStart = SERVICE_AUTO_START Then svStart = SERVICE_DEMAND_START ServiceSetValue("JSService", Start::svStart) ServiceChange("JSService") End
- JP1/Script version
-
Supported from JP1/Script 01-00.