Finding Logged on user from a service

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have a windows service running under the local system account. I want to
be able to impersonate the current user logged onto windows. How can I
determine the current user. APIs all seem to return the name of the user
running the current process. ".\LocalSystem" which is not what I require.
 
I do not know a .NET Framework method to get the logged on user. What
should work is to DllImport the method GetUserName from advapi32.dll and
use that.
 
Back
Top