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

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
Hello,

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

Best regards,
Henning Krause
 
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.
 
Back
Top