Windows Command Line – Query ‘Log on as’ User of a Service

command lineserviceswindows

Currently sc query shows service name, display name and other attributes of the services installed on my box. However it does not tell me what the Log on as setting is. How can I get this information using the command line?

Best Answer

sc query queries the current state; use sc qc to read the configuration.

C:\>sc qc messenger
[SC] GetServiceConfig SUCCESS

SERVICE_NAME: messenger
        TYPE               : 20  WIN32_SHARE_PROCESS
        START_TYPE         : 4   DISABLED
        ERROR_CONTROL      : 1   NORMAL
        BINARY_PATH_NAME   : C:\WINDOWS\system32\svchost.exe -k netsvcs
        LOAD_ORDER_GROUP   :
        TAG                : 0
        DISPLAY_NAME       : Messenger
        DEPENDENCIES       : LanmanWorkstation
                           : NetBIOS
                           : PlugPlay
                           : RpcSS
        SERVICE_START_NAME : LocalSystem