Impersonation and Hosting PowerShell

Some of you reported that Impersonation doesn’t work while hosting PowerShell in ASP.net applications.  The problem occurs when PowerShell’s pipeline is invoked in the following way from an ASP.NET application:          WindowsIdentity winId = (WindowsIdentity)HttpContext.Current.User.Identity;               WindowsImpersonationContext ctx = null;             try             {                 ctx = winId.Impersonate();                 Runspace myRunSpace = RunspaceFactory.CreateRunspace();                 myRunSpace.Open();     … Read more