This would do it.
Change it to your needs.
Please not that this can not be done to all services. Eventlog for example can't be stopped in this like this because it is an essential service. Not that anyone should like to stop an essential service but he who knows what everyone wants.

Code:

;Checks if the requested service is running and changes the start-up type if wanted.
;In this example the Themes service is stopped and set to disabled.
;Status: 0 is boot, 1 is system, 2 is automatic, 3 is manual, 4 is disabled.
;
Break on
;
$Key = "HKLM\SYSTEM\CurrentControlSet\Services\"
$ServiceState = ReadValue ($key + "Themes", "Start")
;
If $ServiceState = "4"
?"Can't start a disabled service. Enable the service manually."
Else
Select
Case $ServiceState = "0"
$ServiceState = "Boot"
Case $ServiceState = "1"
$ServiceState = "System"
Case $ServiceState = "2"
$ServiceState = "Automatic"
Case $ServiceState = "3"
$ServiceState = "Manual"
Case $ServiceState = "4"
$ServiceState = "Disabled"
EndSelect
;
Shell '%comspec% /c net start | find /i "Themes"'
;
Select
Case @ERROR = "0"
?"Themes service is running and starts: " + $serviceState
Shell '%comspec% /c net stop "Themes"'
$rd = WriteValue ($key + "Themes", "Start", "4", "REG_DWORD")
?"Requested service was running and is set to disabled."
Case @ERROR <> "0" AND $ServiceState ="0"
WriteValue ($key + "Themes", "Start", "4", "REG_DWORD")
Case @ERROR <> "0" AND $ServiceState ="1"
WriteValue ($key + "Themes", "Start", "4", "REG_DWORD")
Case @ERROR <> "0" AND $ServiceState ="2"
WriteValue ($key + "Themes", "Start", "4", "REG_DWORD")
Case @ERROR <> "0" AND $ServiceState ="3"
WriteValue ($key + "Themes", "Start", "4", "REG_DWORD")
Case @ERROR <> "0" AND $ServiceState = "4"
?"Requested service is not running and has status disabled."
Case @ERROR <> "0" AND $ServiceState <> "4"
WriteValue ($key + "Themes", "Start", "4", "REG_DWORD")
?"Requested service is not running and is set to disabled."
EndSelect
EndIf
;
@CRLF
Do
?"Please check the messages above [Q to Quit] " Get $x
Until $x = "q"



Edited by R2D2 (2005-04-25 10:19 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.