Home All Groups Group Topic Archive Search About

.NET service running as user (HKEY_CURRENT_USER?)

Author
16 Feb 2007 3:15 PM
Mike
Greetings,

I trust that I am writing to the correct newsgroup or that at least I
can find direction here.

We have an issue with a custom-developed service which we would like
to run as a specified set of user credentials. This is on account of a
DLL resource which utilizes HKEY_CURRENT_USER registry settings in
order to operate. We are operating under the assumption that if the
service runs as a specified user, then that process utilizes the
settings specified under HKEY_CURRENT_USER.

If that isn't feasible, then we need to start looking at HKEY_USERS,
which gets somewhat ugly. How do we glean the key(s) from user
Security Identities (SID)?

Regardless, it would seem that we're faced with utilizing 32-bit API
from within our C# .NET code.

Thanks in advance...

Michael

Author
16 Feb 2007 6:05 PM
Chris Mullins [MVP]
I'm somewhat confused as to your problem.

Certainly creating a user account, granting it Service & Batch privlidges,
setting it's password to "never expires" and configuring a Windows Service
to run as that account is no trouble. This works just fine.

So from here, you're just trying to open the Current User registry hive. I'm
not sure if this is your service account (although I suspect it is) or the
interactive user. This can't take more than 5 minutes to test though. Open
the hive from your service (running as "testuser"), and write to a key.
Then, from the interactive account run regedit and take a quick look.

--
Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
http://www.coversant.com/blogs/cmullins

Show quote
"Mike" <mwpowel***@comcast.net> wrote in message
news:1171638931.118505.41260@m58g2000cwm.googlegroups.com...
> Greetings,
>
> I trust that I am writing to the correct newsgroup or that at least I
> can find direction here.
>
> We have an issue with a custom-developed service which we would like
> to run as a specified set of user credentials. This is on account of a
> DLL resource which utilizes HKEY_CURRENT_USER registry settings in
> order to operate. We are operating under the assumption that if the
> service runs as a specified user, then that process utilizes the
> settings specified under HKEY_CURRENT_USER.
>
> If that isn't feasible, then we need to start looking at HKEY_USERS,
> which gets somewhat ugly. How do we glean the key(s) from user
> Security Identities (SID)?
>
> Regardless, it would seem that we're faced with utilizing 32-bit API
> from within our C# .NET code.
>
> Thanks in advance...
>
> Michael
>

AddThis Social Bookmark Button