|
|
|
| 25 March 2002 | GetServiceStartup() |
| Author | ScriptLogic Corporation |
| Action | Returns the startup state of any service, given its 'short' name. |
| Syntax | GetServiceStartup ("servicename") |
| Parameters | |
| Remarks | This function is only supported on the NT-family of products, (NT/2000/XP, etc.) You must call this function with the 'short' name of the service, not the 'display / long' name. This function returns the startup state of the service, not the current state. |
| Returns | Returns the service startup state. Possible return values include: 'Boot', 'System', 'Automatic', 'Manual', 'Disabled', or 'Not Installed' |
| Examples |
$result = GetServiceStartup("browser")
? 'The Computer Browser Service is set to: '+$result
|
| Source |
FUNCTION GetServiceStartup ($shortname)
; Author: ScriptLogic Corporation
DIM $rc,$key
IF @inwin=1 ; only supported on NT family
$key='HKLM\System\CurrentControlSet\Services\'+$shortname
IF KeyExist($key)
$rc=ReadValue($key,'Start')
SELECT
CASE $rc=0
$getservicestartup='Boot'
CASE $rc=1
$getservicestartup='System'
CASE $rc=2
$getservicestartup='Automatic'
CASE $rc=3
$getservicestartup='Manual'
CASE $rc=4
$getservicestartup='Disabled'
CASE 1
$getservicestartup='Unknown'
ENDSELECT
ELSE
$getservicestartup='Not Installed'
ENDIF
ELSE
$getservicestartup=''
ENDIF
ENDFUNCTION ; - GetServiceStartup -
|
|
|
|