sp [ LIST | CONFIG | START | RESTART | STOP | PAUSE | CONTINUE | CONTROL | QUERY | CREATE | REMOVE | MODIFY | KILL | PARAMCHANGE | INTEROGATE | DEBUG | REGISTER | HELP ]
For detailed information about a command:
sp (Command) /help
/DOMAIN=
/Q Quiet mode. Answers yes to any confirmation message.
/Q
Note that the servername and servicename may contain wildcards (* and ?).
*
?
List service(s) status
sp LIST [[\\servername\]servicename] [/Domain=]
Example:
sp list \\*\spooler
This will list the status of all your Spooler services on all your NT machines
Display service(s) configuration information
sp CONFIG [[\\servername\]servicename] [/Domain=]
sp config \\*\spooler
This command will display the status of all your Spooler services on all your NT machines
Start service(s)
sp START[=Startup Parameters] [\\servername\]servicename
sp start \\server\spooler
Restart service(s)
sp RESTART[=Startup Parameters] [\\servername\]servicename
sp restart \\server\spooler
sp stop \\server\spooler
sp pause \\server\spooler
sp continue \\server\spooler
Send a private control code to your service
sp CONTROL=code servicename
The code must be a value between 128 and 255
code
sp control=128 myservice
Query service status
sp QUERY [\\servername\]servicename [/Domain=]
The command will return an ErrorLevel that is set with the service status ErrorLevel:
0
1
2
3
4
5
6
7
In the following example the Spooler service will be started if the service is stopped:
sp query \\myserver\spooler If ErrorLevel 1 sp \\myserver\spooler start
Send a PARAMCHANGE notification to indicate that service parameters should be reloaded
sp PARAMCHANGE [\\server\]servicename
The server name and the service name may contain jokers (* and ?)
sp paramchange myservice
Send an INTEROGATE command to retrieve updated status information from a service. The command will return an ErrorLevel that is set with the service error code.
sp INTEROGATE [\\server\]servicename
sp interogate myservice
Create a service
sp CREATE [\\servername\]servicename /PATH=Path to executable [/DISPLAYNAME=Service Display Name] [/DESCRIPTION=Service Description] [/ACCOUNT=Domain\User /PASSWORD=xyz] [/DEPEND=service1,service2,etc.] [/INTERACT=1,0] [/STARTUP=MANUAL,AUTO,DISABLED] [/TYPE=OwnProcess,ShareProcess] [/ERRORCONTROL=Ignore,Normal,Severe,Critical]
sp create \\server\myservice /path=c:\svcitocx\sample\service.exe
Remove the service
sp remove [\\servername\]servicename
sp remove \\server\myservice
sp MODIFY [[\\servername\]servicename] [/ACCOUNT=Domain\User /PASSWORD=xyz] [/STARTUP=MANUAL,AUTO,DISABLED] [/DISPLAYNAME=Service Display Name] [DESCRIPTION=Service Description] [/PATH=Path to executable] [/DEPEND=service1,service2,etc.] [/INTERACT=1,0] [/WHEREACCOUNT=Domain\User]
Examples:
sp modify myservice /interact=1
sp modify * /password=NewPassword /whereaccount=Domain\ServiceAccount
Kill the service process
sp KILL servicename
sp kill spooler
The Kill command cannot be used remotely
Start the service and launch your debugger (Such as Microsoft Visual C++)
sp DEBUG servicename
sp debug MyService
The Debug command cannot be used remotely
Install the registration key
sp REGISTER /ID=YourID /Key=YourKey
sp register /ID="Active+ Software" /Key=12345