0

I have a little situation that I can't seem to resolve and was hoping someone might have some suggestions ...

I have a Windows Service (Serv.exe) which runs under LocalSystem when a user is logged-on (it is only running when users are logged-on), this service is responsible for performing various administrative tasks, one of which is applying registry (.reg) files when needed.

The Services uses REGEDIT (/s /i) to merge in the registry files (.reg) - and this is where things get rough - these registry files related to HKEY_CURRENT_USER (for the user currently logged on) - obviously this causes issues because regedit is being run as a LocalSystem (which is not currently in the HKCU of the user itself) ...

Is there anything I can do?
Can I somehow LINK to the users HKCU so that when I apply the .REG file it updates the users registry?
Can I mirror or reflex the changes somehow?

From where I stand my only solution would be to create my own REG EDIT that would redirect to the logged-on users HKCU (which would be a pain). I've already tried creating a service to mirror HKCU->HKLM but the LocalSystem doesn't seem to have an HKCU at all - so that doesn't help ...

Key point - I do NOT have the username & password of the User account so I cannot use Impersonation... And even there I need admin access to perform my changes.

Any help would be greatly appreciated...
Thanks,

2
Contributors
1
Reply
3
Views
7 Years
Discussion Span
Last Post by angilbert
0

I have a little situation that I can't seem to resolve and was hoping someone might have some suggestions ...

I have a Windows Service (Serv.exe) which runs under LocalSystem when a user is logged-on (it is only running when users are logged-on), this service is responsible for performing various administrative tasks, one of which is applying registry (.reg) files when needed.

The Services uses REGEDIT (/s /i) to merge in the registry files (.reg) - and this is where things get rough - these registry files related to HKEY_CURRENT_USER (for the user currently logged on) - obviously this causes issues because regedit is being run as a LocalSystem (which is not currently in the HKCU of the user itself) ...

Is there anything I can do?
Can I somehow LINK to the users HKCU so that when I apply the .REG file it updates the users registry?
Can I mirror or reflex the changes somehow?

From where I stand my only solution would be to create my own REG EDIT that would redirect to the logged-on users HKCU (which would be a pain). I've already tried creating a service to mirror HKCU->HKLM but the LocalSystem doesn't seem to have an HKCU at all - so that doesn't help ...

Key point - I do NOT have the username & password of the User account so I cannot use Impersonation... And even there I need admin access to perform my changes.

Any help would be greatly appreciated...
Thanks,

I would suggest the possibility of using that Serv.exe to query another application which in turn launches itself as the current user and runs the reg files required as the current user. The other thing you could do is create a WMI C# application that can edit the required settings. This can run as a local application either as a service or as a login script/startup file. Let me know if you would like more information about WMI C# applications as I have created 4 of these to do everything from start/stop/install services, to editing reg keys.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.