Hi,
I checked the sample application found on MSDN :
http://msdn.microsoft.com/library/de...nateTopic1.asp
I logged on as a normal user, i impersonated the administrator account,
tried to run Shutdown.exe, it gives me access denied. Can someone tell me
why?
here's the code:
Console.WriteLine("After impersonation: "
+ WindowsIdentity.GetCurrent().Name);
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = @"C:\WINDOWS\system32\shutdown.exe";
p.StartInfo.Arguments = "/s";
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = false;
p.Start();
p.WaitForExit();
string output = p.StandardOutput.ReadToEnd();
Console.WriteLine(output);
// Stop impersonating the user.
impersonatedUser.Undo();
// Check the identity.
Console.WriteLine("After Undo: " +
WindowsIdentity.GetCurrent().Name);
thanks a lot
mustafa