How to Manage Windows Services Using CMD

How to find out the status of Windows services

To find out the status of a particular Windows service, we can use the command sc query by adding the service name as a parameter. This command displays information about the service in question, including its status.

Here’s an example of how to find out the status of service Windows Update:

C:\Windows\system32>sc query wuauserv

SERVICE_NAME: wuauserv
DISPLAY_NAME: Windows Update
        TYPE               : 20  WIN32_SHARE_PROCESS
        STATE              : 4  RUNNING
                                (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

From the output above, we can see that the service Windows Update is running (RUNNING) and can be stopped, paused, or turned off (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN).

If we don’t know the exact name of the service, we can use the sc queryex command by adding the display name of the service as a parameter. This command will display the same information as the sc query command but also display the PID or Process ID of the service, which is the identification number of the process running the service.

Here’s an example of how to find out the status of service Windows Firewall:

C:\Windows\system32>sc queryex “Windows Firewall”

SERVICE_NAME: MpsSvc
DISPLAY_NAME: Windows Firewall
        TYPE               : 20  WIN32_SHARE_PROCESS
        STATE              : 4  RUNNING
                                (STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0
        PID                : 1004
        FLAGS              :

From the output above, we can see that service Windows Firewall has the name of service MpsSvc and is running with PID 1004. This Service can also be stopped, paused, or turned off (STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN).

How to change the startup mode of a Windows service

The Windows service startup mode is a setting that determines how the service is run when the system is turned on. There are several Windows service startup modes, namely:

  • Automatic: This service will run automatically when the system is turned on, without the need for user or administrator intervention.
  • Manual: This service will not be executed automatically when the system is turned on but can be run manually by the user or administrator through CMD or other user interfaces.
  • Disabled: This service will not run at all, either automatically or manually. This service can only be reactivated by an administrator.

To change the startup mode of a Windows service, we can use the command sc config by adding the name of the service and the desired startup mode as parameters. This command will change the registry settings associated with that service.

Here’s an example of how to change the service startup mode from Windows Defender Antivirus Service to Manual:

C:\Windows\system32>sc config WinDefend start= demand
[SC] ChangeServiceConfig SUCCESS

From the output above, we can see that the command successfully changed the startup mode of the WinDefend service to demand, which means Manual. Note that there is a space after the equal sign (=) in this command.

Here is a list of startup modes that can be used as parameters in the sc config command:

  • boot: This service will run before the operating system loads. Only kernel and file system services can use this mode.
  • system: This service will run when the operating system loads. Only kernel and file system services can use this mode.
  • auto: This service will run automatically when the system is turned on. This is the same as Automatic mode.
  • demand: This service will not run automatically when the system is turned on but can be run manually. This is the same as Manual mode.
  • disabled: This service will not run at all. This is the same as the Disabled mode.

Latest Articles