internal System.Management.Automation.PowerShell NewPowerShell() { if (IsRunning) { return(powerShell.CreateNestedPowerShell()); } powerShell = System.Management.Automation.PowerShell.Create(); powerShell.Runspace = host.Runspace; return(powerShell); }