Using SC Commands to Manage Services In Windows – Reference Article
Target Audience: IT Manager
Article #: 6816
Summary
This Reference Article defines and explains the topic of use SC Commands with services management in Windows.
Information
There are times, when performing routine Window server management, when Services in Windows need to be start, stop, change password, add or remove dependencies, etc.. There are two methods:
- NET commands
- SC commands
#1. NET Commands
In the past, the NET command can be used to start, stop or pause services only. If you want to make other changes to the services, you will have to do it via the MMC plug-in or SC commands.
#2. SC Commands
SC command is a command line interface that communicates directly with Service Control Manager. You can use SC to perform tasks against service that normally require MMC plug-in. Unlike NET command, you can use SC to manage services on another computer.
Here are some of the differences between SC and NET commands (excerpt from https://superuser.com/questions/315166/net-start-service-and-sc-start-what-is-the-difference)
netis older – from the days of MS-DOS and OS/2, in fact.sconly appeared with Windows NT (not sure which version).netcan only start, stop and pause services.schas more advanced controls, can query state, create and delete services, change their configuration and security:sc config beep start= demandnetonly works locally.sccan be used over the network:sc \\snow start rpcapdnetaccepts display names:net start "Windows Firewall"scalways requires a service name:sc start SharedAccess
and
"net" is synchronous and "sc" is asynchronous. SC sends the control to the service and then returns to the command prompt. This typically results in SC START returning the service in a state of START_PENDING. NET START will wait for the service it is starting to come to a fully started state before it returns control at the command prompt. ... SC START, SC STOP does not wait for the service to come to a stop and will there for often return STOP_PENDING for many service stop operations. NET STOP on the other hand will wait on the service to stop before it returns to the command prompt. ... NET and SC have different ideas of what they consider to be success conditions. The question SC asks to determine if it was successful is, “Did I successfully send a stop control to the service?” If it did, regardless of whether the service stopped, then I satisfied the successful condition. NET asks the question, “Did the service I attempted to stop, return that it stopped successfully?” If it did, then it satisfied the condition. If it didn’t, no matter what the reason, then NET fails the successful condition
Basic options for SC:
DESCRIPTION: SC is a command line program used for communicating with the Service Control Manager and services. USAGE: sc <server> [command] [service name] <option1> <option2>... The option <server> has the form "\\ServerName" Further help on commands can be obtained by typing: "sc [command]" Commands: query-----------Queries the status for a service, or enumerates the status for types of services. queryex---------Queries the extended status for a service, or enumerates the status for types of services. start-----------Starts a service. pause-----------Sends a PAUSE control request to a service. interrogate-----Sends an INTERROGATE control request to a service. continue--------Sends a CONTINUE control request to a service. stop------------Sends a STOP request to a service. config----------Changes the configuration of a service (persistent). description-----Changes the description of a service. failure---------Changes the actions taken by a service upon failure. failureflag-----Changes the failure actions flag of a service. sidtype---------Changes the service SID type of a service. privs-----------Changes the required privileges of a service. managedaccount--Changes the service to mark the service account password as managed by LSA. qc--------------Queries the configuration information for a service. qdescription----Queries the description for a service. qfailure--------Queries the actions taken by a service upon failure. qfailureflag----Queries the failure actions flag of a service. qsidtype--------Queries the service SID type of a service. qprivs----------Queries the required privileges of a service. qtriggerinfo----Queries the trigger parameters of a service. qpreferrednode--Queries the preferred NUMA node of a service. qrunlevel-------Queries the run level of a service. qmanagedaccount-Queries whether a services uses an account with a password managed by LSA. qprotection-----Queries the process protection level of a service. delete----------Deletes a service (from the registry). create----------Creates a service. (adds it to the registry). control---------Sends a control to a service. sdshow----------Displays a service's security descriptor. sdset-----------Sets a service's security descriptor. showsid---------Displays the service SID string corresponding to an arbitrary name. triggerinfo-----Configures the trigger parameters of a service. preferrednode---Sets the preferred NUMA node of a service. runlevel--------Sets the run level of a service. GetDisplayName--Gets the DisplayName for a service. GetKeyName------Gets the ServiceKeyName for a service. EnumDepend------Enumerates Service Dependencies. The following commands don't require a service name: sc <server> <command> <option> boot------------(ok | bad) Indicates whether the last boot should be saved as the last-known-good boot configuration Lock------------Locks the Service Database QueryLock-------Queries the LockStatus for the SCManager Database EXAMPLE: sc start MyService
Important:
- The Service Name used in SC command refers to the actual name of the service. It is not the same as the name you see in the Service Console. In the example below, the Workstation service as shown in the Service Console is actually named LanmanWorkstation. When entering the service name information in the SC command, remember to use Service name.


- A successful SC execution does not mean that the command you issued to the SC was executed successfully. It only means that SC was successful in submitting the command to Service Control process. You should use secondary method to confirm the successful execution of your command.
Examples
To stop the TkxSvrService service
SC Stop “TkxSvrService“
To remove dependencies from the TkxSvrService service
SC config “TkxSvrService” depend=/
To add dependency to the TkxSvrService service
SC config “TkxSvrService” depend=”SLicense“

Author
Related Articles
- TEKLYNX License Service Could Not Start – Windows Error
- Installing/Upgrading .NET Before Installing IIS – Windows Problem
- Using Local Account to Log Into Domain Computer – Windows Instructions
- Printer Settings in Windows – Windows Reference
- “This Software version too old for this Microsoft Operating System” – TEKLYNX Error Message
- Corrupted Junction Points Prevent Software from Installing – Windows Problem
