esi-ntservice
A library that supplies helper methods for using the sc.exe command (windows services)
Changes
version | date | description |
---|---|---|
1.72.0 |
2020-12-08 |
TFS code synchronisation |
1.0.0 |
2020-10-21 |
Initial release |
Available functions
All functions have to be called according to the ESI standard, using colons, e.g. lib:FUNCTIONNAME(params)
Documentation
Most methods below have 2 optional parameters:
Parameter | Description |
---|---|
logFunction |
Callback function with single parameter of type string |
waitTime |
Additional time to wait in seconds after call to sc.exe or popen. |
GET_ENV
GET_ENV(variableName)
Return the value of an environment variable. If the provided VariableName does not exist, an invalid string will be returned.
SC_EXISTS
SC_EXISTS(serviceName, logFunction)
Check if service exists (sc.exe query), returns true if it does exist.
SC_START
SC_START(serviceName, logFunction, waitTime)
Wrapper around the system sc.exe start command.
SC_RESTART
SC_RESTART(serviceName, logFunction, waitTime)
Tries to restart service by calling net stop "{serviceName}" && net start "{serviceName}".
SC_CONFIG
SC_CONFIG(serviceName, paramString, logFunction, waitTime)
Wrapper method around the system sc.exe config command. Can be used to configure service parameters. paramString allows to specify service parameters, like startup type or user/password.
The available value allowed for paramString are explained here.