.NET service running as user (HKEY_CURRENT_USER?)

M

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
 
C

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top