Service+ CL Documentation

Syntax

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

Optional parameters valid for most commands

/DOMAIN=

/Q Quiet mode. Answers yes to any confirmation message.

Note that the servername and servicename may contain wildcards (* and ?).

LIST command

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

CONFIG command

Display service(s) configuration information

sp CONFIG [[\\servername\]servicename] [/Domain=]

Example:

sp config \\*\spooler

This command will display the status of all your Spooler services on all your NT machines

START command

Start service(s)

sp START[=Startup Parameters] [\\servername\]servicename

Example:

sp start \\server\spooler

RESTART command

Restart service(s)

sp RESTART[=Startup Parameters] [\\servername\]servicename

Example:

sp restart \\server\spooler

STOP commandStop service(s) sp STOP [\\servername\]servicename

Example:

sp stop \\server\spooler

PAUSE commandPause service(s) sp PAUSE [\\servername\]servicename

Example:

sp pause \\server\spooler

CONTINUE commandContinue the service sp CONTINUE [\\servername\]servicename

Example:

sp continue \\server\spooler

CONTROL command

Send a private control code to your service

sp CONTROL=code servicename

The code must be a value between 128 and 255

Example:

sp control=128 myservice

QUERY command

Query service status

sp QUERY [\\servername\]servicename [/Domain=]

The command will return an ErrorLevel that is set with the service status ErrorLevel:

  • 0 The service is not installed
  • 1 The service is stopped
  • 2 The service is starting
  • 3 The service is stopping
  • 4 The service is started
  • 5 The service is continuing
  • 6 The service is pausing
  • 7 The service is paused

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

PARAMCHANGE command

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 ?)

Example:

sp paramchange myservice

INTEROGATE command

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

Example:

sp interogate myservice

CREATE command

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]

Example:

sp create \\server\myservice /path=c:\svcitocx\sample\service.exe

REMOVE command

Remove the service

sp remove [\\servername\]servicename

Example:

sp remove \\server\myservice

MODIFY command

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]

Example:

sp modify myservice /interact=1

KILL command

Kill the service process

sp KILL servicename

Example:

sp kill spooler

The Kill command cannot be used remotely

DEBUG command

Start the service and launch your debugger (Such as Microsoft Visual C++)

sp DEBUG servicename

Example:

sp debug MyService

The Debug command cannot be used remotely

REGISTER command

Install the registration key

sp REGISTER /ID=YourID /Key=YourKey

Example:

sp register /ID="Active+ Software" /Key=12345