CodeSteps

Python, C, C++, C#, PowerShell, Android, Visual C++, Java ...

Windows – SC Command – List all Services

Windows Services are the Applications which are running in the background to do specified operations. Windows provides Graphical User Interface to manage the Services. And also it provides some command line tools to manage the Windows Services from the command prompt.

Through this Article, we are going to discuss one of the command line tool; SC command to list the Windows Services from the Command Prompt.

SC command – Service Controller

SC command (Service Controller) is used to manage the Windows Services from the command prompt. It takes arguments to manage the services. If you type just SC command at Windows command prompt; it will display the help information of the command.

Through this command you can query the list of Services currently available in your Windows System. It takes sub commands as arguments to do required actions.

SC command to List all Services

To list all the Services, you need to pass the sub command query to this command as an argument. Here is the example of SC command to list all Services currently available in the Windows System:

C:\>sc query

List the details of the specific Service

Above command displays the list of all Services. To display the details of the specific Service, you need to pass the Service Name to above command as an argument. Then the command looks like below;

C:\>sc query dnscache

SERVICE_NAME: dnscache
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0

Observe that, above result shows useful information of the Service “dnscache“. Importantly, the STATE filed tells whether the Service in RUNNING state or not. That is useful to check whether our Service is running or not.

If the provided service does NOT exist, SC command throws below failure message.

C:\>sc query codesteps
[SC] EnumQueryServicesStatus:OpenService FAILED 1060:

The specified service does not exist as an installed service.

By using query sub command we can see the running state of the Service(s). But how to display the configuration information of the Service? Below section explains this.

Get configuration information of the service

qc sub command is used to get the configuration information of the given Service. You need to pass this sub command and the Service Name as arguments to the SC command.

For example, to display the configuration information of the service “dnscache”, you need to run the below command from Windows command prompt;

C:\>sc qc dnscache
[SC] QueryServiceConfig SUCCESS

SERVICE_NAME: dnscache
TYPE : 10 WIN32_OWN_PROCESS
START_TYPE : 2 AUTO_START
ERROR_CONTROL : 1 NORMAL
BINARY_PATH_NAME : C:\windows\system32\svchost.exe -k NetworkService
LOAD_ORDER_GROUP : TDI
TAG : 0
DISPLAY_NAME : DNS Client
DEPENDENCIES : Tdx
: nsi
SERVICE_START_NAME : NT AUTHORITY\NetworkService

Configuration details contains the details of how the Service been created and the Display name and Process name of the Service along with any dependencies.

Be on learning path always!

// Malin

Windows – SC Command – List all Services

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top