Compartir a través de


Sc.exe query

Obtiene y muestra información sobre el servicio, el controlador, el tipo de servicio o el tipo de controlador especificados.

Syntax

sc.exe [<servername>] query [<servicename>] [type= {driver | service | all}] [type= {own | share | interact | kernel | filesys | rec | adapt}] [state= {active | inactive | all}] [bufsize= <Buffersize>] [ri= <Resumeindex>] [group= <groupname>]

Parameters

Parameter Description
<servername> Especifica el nombre del servidor remoto en el que se encuentra el servicio. El nombre debe usar el formato de convención de nomenclatura universal (UNC) (por ejemplo, \myserver). Para ejecutar SC.exe localmente, no use este parámetro.
<servicename> Specifies the service name returned by the getkeyname operation. This query parameter isn't used in conjunction with other query parameters (other than servername).
type= {driver | service | all} Especifica qué enumerar. Entre estas opciones se incluyen:
  • driver - Specifies that only drivers are enumerated.
  • service - Specifies only services are enumerated. Este es el valor predeterminado.
  • all - Specifies that both drivers and services are enumerated.
type= {own | share | interact | kernel | filesys | rec | adapt} Especifica el tipo de servicios o el tipo de controladores que se van a enumerar. Entre estas opciones se incluyen:
  • own - Specifies a service that runs in its own process. No comparte un archivo ejecutable con otros servicios. Este es el valor predeterminado.
  • share - Specifies a service that runs as a shared process. Comparte un archivo ejecutable con otros servicios.
  • kernel - Specifies a driver.
  • filesys - Specifies a file system driver.
  • rec - Specifies a file system-recognized driver that identifies file systems used on the computer.
  • interact - Specifies a service that can interact with the desktop, receiving input from users. Los servicios interactivos deben ejecutarse en la cuenta LocalSystem. This type must be used in conjunction with type= own or type= shared (for example, type= interacttype= own). Using type= interact by itself will generate an error.
state= {active | inactive | all} Especifica el estado iniciado del servicio que se va a enumerar. Entre estas opciones se incluyen:
  • active - Specifies all active services. Este es el valor predeterminado.
  • inactive - Specifies all paused or stopped services.
  • all - Specifies all services.
bufsize= <Buffersize> Especifica el tamaño (en bytes) del búfer de enumeración. El tamaño de búfer predeterminado es 1,024 bytes. Debe aumentar el tamaño del búfer cuando la presentación resultante de una consulta supere los 1024 bytes.
ri= <Resumeindex> Especifica el número de índice en el que se va a iniciar o reanudar la enumeración. El valor predeterminado es 0 (cero). Si se devuelve más información que lo que puede mostrar el búfer predeterminado, use este parámetro con el parámetro bufsize=.
group= <Groupname> Especifica el grupo de servicios que se va a enumerar. De forma predeterminada, se enumeran todos los grupos. De forma predeterminada, se enumeran todos los grupos (**group= **).
/? Muestra la ayuda en el símbolo del sistema.

Remarks

  • Cada opción de línea de comandos (parámetro) debe incluir el signo igual como parte del nombre de la opción.

  • A space is required between an option and its value (for example, type= own. Si se omite el espacio, se produce un error en la operación.

  • The query operation displays the following information about a service: SERVICE_NAME (service's registry subkey name), TYPE, STATE (as well as states which are not available), WIN32_EXIT_B, SERVICE_EXIT_B, CHECKPOINT, and WAIT_HINT.

  • The type= parameter can be used twice in some cases. The first appearance of the type= parameter specifies whether to query services, drivers, or both (all). The second appearance of the type= parameter specifies a type from the create operation to further narrow a query's scope.

  • When the display results from a query command exceed the size of the enumeration buffer, a message similar to the following is displayed:

    Enum: more data, need 1822 bytes start resume at index 79
    
    To display the remaining **query** information, rerun **query**, setting **bufsize=** to be the number of bytes and setting **ri=** to the specified index. For example, the remaining output would be displayed by typing the following at the command prompt:
    
    sc.exe query bufsize= 1822 ri= 79
    

Examples

Para mostrar información solo para los servicios activos, escriba cualquiera de los siguientes comandos:

sc.exe query
sc.exe query type= service

Para mostrar información de los servicios activos y especificar un tamaño de búfer de 2000 bytes, escriba:

sc.exe query type= all bufsize= 2000

To display information for the wuauserv service, type:

sc.exe query wuauserv

Para mostrar información de todos los servicios (activos e inactivos), escriba:

sc.exe query state= all

Para mostrar información de todos los servicios (activos e inactivos), a partir de la línea 56, escriba:

sc.exe query state= all ri= 56

Para mostrar información de los servicios interactivos, escriba:

sc.exe query type= service type= interact

Para mostrar información solo para controladores, escriba:

sc.exe query type= driver

Para mostrar información de los controladores en el grupo Especificación de interfaz de controlador de red (NDIS), escriba:

sc.exe query type= driver group= NDIS