How to get username/password info of a windows service user accoun

G

Guest

Hello, friends,

In windows service, after specifying username/password in installer like the
follows:

this.serviceProcessInstaller1.Password = "12345";
this.serviceProcessInstaller1.Username = "prodDomain\\appUser";

and installing this window service, I believe this windows service will be
run under the specified user account each time it is started.

Then the question is: If I want to retrieve username/password info in this
windows service itself, how can I do it?

Thanks a lot.
 
H

Henning Krause [MVP - Exchange]

Hello,

you can't. All you can get is the username - via
WindowsIdentity.GetCurrent().

Best regards,
Henning Krause
 
P

-pb-

Hi,

You cannot get password of any windows account. If you want to service
account information then try using it via
CredentialCache.DefaultNetworkCredentials. Password will never be
exposed from .Net.
 

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