0

I've found some C# code online to impersonating a user and it appears to work fine as when I call 'WindowsIdentity.GetCurrent().Name' I get the impersonated users name.

However I then run an application via code and it's loaded using my details and not the impersonated user.

I'm running the application as the user is impersonated as such

 sResult += "After impersonation: " + WindowsIdentity.GetCurrent().Name + "\r\n";
                Process myProcess = new Process();

                myProcess.StartInfo.FileName = ConfigurationSettings.AppSettings["Program"];
                myProcess.StartInfo.UseShellExecute = false;
                myProcess.Start();
                MessageBox.Show(this, sResult, "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);

This is the impersonation code I am using http://www.codeproject.com/Articles/4051/Windows-Impersonation-using-C

So how do I get this application to launch as the impersonated user?

Gavin Mannion
  • 875
  • 1
  • 14
  • 32
  • 1
    I don't know that you can launch your program as another user without his password. I mean, if you could do that, then the whole security model is pointless. There seems to be some good info here: http://stackoverflow.com/questions/559719/windows-impersonation-from-c-sharp – Bob Horn Mar 23 '12 at 13:20
  • I have the password.. I can impersonate the user just fine but when the process runs it's running as me... – Gavin Mannion Mar 28 '12 at 10:50

1 Answers1

0

Okay found the answer elsewhere on Stack Overflow...

Start a .Net Process as a Different User

I don't need all this impersonation nonsense just to run an app... nice to know

Community
  • 1
  • 1
Gavin Mannion
  • 875
  • 1
  • 14
  • 32