コード例 #1
0
        internal Pipeline CreatePipeline(RemoteRunspace remoteRunspace)
        {
            PowerShell shell    = remoteRunspace.GetCapabilities().Equals(RunspaceCapability.Default) ? this.GetPowerShellForPSv2() : this.GetPowerShellForPSv3();
            Pipeline   pipeline = remoteRunspace.CreatePipeline(shell.Commands.Commands[0].CommandText, true);

            pipeline.Commands.Clear();
            foreach (Command command in shell.Commands.Commands)
            {
                pipeline.Commands.Add(command);
            }
            pipeline.RedirectShellErrorOutputPipe = true;
            return(pipeline);
        }