views:

112

answers:

1

How do I determine what account a service is running as from within the service itself.

+6  A: 

A language would have been useful..

In C++: GetUserName

C#

System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
Adam Peck
Strange. I could have sworn I tried that before, but this time it seems to be working perfectly.
Jonathan Allen