mattjohnsonpint/SimpleImpersonation

Ability to impersonate the currently logged in user without credentials

JohnFredMeyer opened this issue · 1 comments

Was wondering if you'd be willing to add support to impersonate the currently logged in user without credentials.

Example. I have a windows service running and would like to impersonate the user that is currently logged in because the service is running under the windows system account. I understand now i could currently still use this library but it would require knowing the username and password of each and every user. I found this library
https://github.com/murrayju/CreateProcessAsUser where they get the user token through WTSEnumerateSessions to get the active session id then WTSQueryUserToken to retrieve the user token.

If you have a user token, then you don't need this library. Just use WindowsIdentity.RunImpersonated directly.