Run Code as a different user
Probably the best and the cleanest code that I have seen so far is this: var credentials = new UserCredentials(domain, username, password); Impersonation.RunAsUser(credentials, logonType, () => { // do whatever you want as this user. }); Just follow Github or Nuget.