How do I retrieve the username that a Windows service is running under?

后端 未结 6 1094
無奈伤痛
無奈伤痛 2020-12-09 09:44

Given a service name, I would like to retrieve the username that it runs under (i.e. the username shown in the \'Log On\' tab of a service\'s properties window). There doesn

6条回答
  •  余生分开走
    2020-12-09 10:24

    You can find this using the Windows Registry, reading the following string value, replacing [SERVICE_NAME] with the name of the Windows Service:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\[SERVICE_NAME]\ObjectName
    

提交回复
热议问题