JSI Tip 0465 - Using Sc.exe and Netsvc.exe to manage a remote service.
March 24, 1998
contains many new and updated utilities.
Sc.exe is a tool that provides a way to communicate with the Service Control Manager to retrieve/manage information about services.
Netsvc.exe is a tool to remotely start, stop, and query the status of services from the command line.
You can use these tools to configure the Startup of a service and to remotely Start and Stop a service while registering the change with the Services Control Manager, as long as you have Admin priviledges on both machines.
The following example will configure the Schedule service on \NTWORK1 to start Automatically, start it, check it's configuration and status:
sc \NTWORK1 config Schedule start= auto
[SC] ChangeServiceConfig SUCCESS
netsvc /start \NTWORK1 "Schedule"
Service is pending start on \NTWORK1
sc \NTWORK1 qc Schedule
[SC] GetServiceConfig SUCCESS
SERVICE_NAME: Schedule
TYPE : 10 WIN32_OWN_PROCESS
START_TYPE : 2 AUTO_START
ERROR_CONTROL : 1 NORMAL
BINARY_PATH_NAME : C:WINNTSystem32AtSvc.Exe
LOAD_ORDER_GROUP :
TAG : 0
DISPLAY_NAME : Schedule
DEPENDENCIES :
SERVICE_START_NAME : LocalSystem
netsvc /query \NTWORK1 "Schedule"
Service is running on \NTWORK1
About the Author
You May Also Like