master
Raw Download raw file

date: “2016-12-01” draft: false title: “sc”


Alternatives

  • SysInt: [psservice]({{< relref “windows/sysinternals/psservice.md” >}})
  • WMIC: [service]({{< relref “windows/wmic/service.md” >}})
  • PS: [service]({{< relref “windows/powershell/service.md” >}})

The Services Controller (SC) utility is native to Windows, and is included with the installation of the operating system. It includes a number of options that provide the functionality to allow you to view, manage and configure the services on the local computer as well as a remote computer.

Usage

NOTE: The sc utility does not accept the DISPLAY_NAME of a service as input. You must use the service’s SERVICE_NAME (also referred to as its KEY_NAME) as input to the command. To find the SERVICE_NAME associated with a service, using the following command syntax: sc getkeyname “DISPLAY_NAME”

Examples

<SN> = <SERVICE NAME>

command description
sc /? show help
sc getkeyname "<DISPLAY NAME>" returns
sc stop <SN>
sc start <SN>
sc config <SN> start= disabled
sc config <SN> start= auto
sc qc <SN> start_type, binary_path_name, load_order_group, display_name, dependencies, service_name
sc enumdepend <SN> find services that depend on
sc \\<REMOTE.PC> query &#124 clip && notepad open results of remote query in notepad

sc getkeyname

This command returns a SERVICE_NAME (Also known as a KEY_NAME) from a given DISPLAY_NAME

sc query

Without any arguments this command returns a listing of all services installed on the system and the state of each service. Here’s a cool trick to get the output of this command into notepad, without creating a file:

# This puts the output of the command into the clipboard and opens notepad
# You are then one CTRL+V away from having the output in notepad.
sc \\REMOTE.PC query | clip && notepad
# Query for the telnet service
sc getkeyname "Telnet"
# Returns "TlntSvr"
sc query TlntSvr

sc <stop | pause | continue | start>

Use the commands above to stop, pause, continue, or start a service.

sc qc

This command shows the configurable data associated with a process. The qc could stand for “query configuration.”

# Show the configuration for the "Netowork Connections" service
sc getkeyname "Network Connections"
# returns "Netman"
sc qc netman
# Returns all the configurable data

sc config

This allows a configuration parameter to be changed on a service.

# Change netlogon from auto_start to disabled
sc config netlogon start= disabled

sc EnumDepend

The EnumDepend shows what services depend on the given service.

sc getkeyname "Workstation"
# returns LanmanWorkstation
sc EnumDepend LanmanWorkstation

To see what dependencies a certain service has, checkout it’s configuration:

sc qc Browser
# Shows LanmanWorkstation as a dependency