Understanding SC- Service Console commands
Today in this article we will learn useful SC- Service Console commands required to start or stop services.
SC is a command-line program used for communicating with the Service Control Manager and services.
Today in this article, we will cover below aspects,
It lets you Create, Start or Stop or Delete services mainly windows services hosted in the Windows environment
Usage
sc <server> [command] [service name] <command1> <command2>...
Further help on commands can be obtained by typing: “sc [command]”
Useful Commands
Create a Service
sc create- Creates a service. (adds service to the registry).
Start a Service
sc start - Starts a service.
Stop a Service
sc stop- Sends a STOP request to a service.
Delete a Service
delete - Deletes a service from SC Manager and (from the registry).
Pause a Service
pause - Sends a PAUSE control request to a service.
Other Useful 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.
interrogate- Sends an INTERROGATE control request to a service.
continue-Sends a CONTINUE control 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.
qmanagedaccount-Queries whether a services uses an account with a password managed by LSA.
qprotection-Queries the process protection level of a service.
quserservice-Queries for a local instance of a user service template.
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.
GetDisplayName--Gets the DisplayName for a service.
GetKeyName-Gets the ServiceKeyName for a service.
EnumDepend- Enumerates Service Dependencies.
Note: You might get an error running SC commands on the console or CLI. To fix the issue run the command prompt in Admin mode.
That’s All. Please sound off your comments below if any
Please bookmark this page and share it with your friends. Please Subscribe to the blog to receive notifications on freshly published(2024) best practices and guidelines for software design and development.