Install a Windows service as a user

I am currently creating a Windows application that will track changes to certain keys entered in the HKEY_USERS registry. The way I do this is to collect the SID of the current user. The problem I am facing is that it returns the SID of administrators due to the service currently running as the local system.

I need a system that needs to be done is to collect and return the SID of the current registered user (by this I do not mean the local service, the local system or the network service, but the person who went into the windows through GINA), so what I need is for the service to run, it starts as this user. It will also allow the service to write back to the network drive of the user, which is the goal of this program.

The problem I am facing is that when I try to install a user service using installutil.exe, it asks for a username and password, now I tried my own credentials (I have an administrator account and non admin) but it doesn’t have any of them, plus I want the user to change depending on who is logging in and not being fixed. Is there any way to do this?

+3
source share
3 answers

. . , HKCU. - , autorun exe, . , , .

+1

" " Windows , . Windows . . , , , .

+2

, , explorer.exe, SID , ( WMI, )

0

Source: https://habr.com/ru/post/1722681/


All Articles