Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Use the \sc query\ Command to Manage Windows Services via CMD

The "sc query" command in Windows is a powerful tool that allows you to query the status of services on a local or remote machine. This command is part of the Service Control (SC) utility, which is a command-line tool used for communicating with the Service Control Manager and services.

Understanding the "sc query" Command

The "sc query" command can be used to obtain detailed information about the services running on a Windows system. It provides insights into the service name, display name, type, state, and other essential attributes. This command is particularly useful for system administrators who need to manage and troubleshoot services.

Examples

Example 1: Query All Services

To list all services on the local machine, open Command Prompt and type:

sc query

This command will display a list of all services, including their status (running, stopped, etc.).

Example 2: Query a Specific Service

To query a specific service, you need to know the service name. For example, to query the "Windows Update" service, use:

sc query wuauserv

This will provide detailed information about the "Windows Update" service, such as its state (running, stopped, paused), type, and other parameters.

Example 3: Query Services on a Remote Machine

To query services on a remote machine, you can use the following syntax:

sc \\RemoteMachineName query

Replace RemoteMachineName with the actual name of the remote computer. This command requires appropriate permissions to access the remote machine's services.

Example 4: Query Services with Specific Status

You can also filter services by their status. For example, to list all running services, use:

sc query state= running

Make sure there is a space after the equal sign.

Additional Tips

  • Service Names vs. Display Names: The "sc query" command uses service names, which might differ from the display names seen in the Services management console. You can find the service name by querying all services and looking for the corresponding display name.
  • Permissions: Running "sc query" on a remote machine or querying certain services might require administrative privileges.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.