B
Balamurugan KR
I want to impersonate as different use and need to start a process
WindowsImpersonationContext impersonatedUser = winID.Impersonate(); // here
user is impersonated
Console.WriteLine("After impersonation: "+
WindowsIdentity.GetCurrent().Name);
myProcess = new Process();
ProcessStartInfo myProcessStartInfo = new
ProcessStartInfo(Environment.GetEnvironmentVariable("systemdrive") +
@"\test.exe"); // but this process runs under wrong account and not on the
impersonated one
myProcess.StartInfo = myProcessStartInfo;
myProcess.Start();
myProcess.WaitForExit();
StreamReader sr = myProcess.StandardOutput; // output returned by text.exe
Here the test.exe writes to the console (standard output). I do not want to
use CreateProcessAsUser since this API does not have an option to return
the standard output back to the caller
Any help will be greatly Appreciated
WindowsImpersonationContext impersonatedUser = winID.Impersonate(); // here
user is impersonated
Console.WriteLine("After impersonation: "+
WindowsIdentity.GetCurrent().Name);
myProcess = new Process();
ProcessStartInfo myProcessStartInfo = new
ProcessStartInfo(Environment.GetEnvironmentVariable("systemdrive") +
@"\test.exe"); // but this process runs under wrong account and not on the
impersonated one
myProcess.StartInfo = myProcessStartInfo;
myProcess.Start();
myProcess.WaitForExit();
StreamReader sr = myProcess.StandardOutput; // output returned by text.exe
Here the test.exe writes to the console (standard output). I do not want to
use CreateProcessAsUser since this API does not have an option to return
the standard output back to the caller
Any help will be greatly Appreciated