protected override void BeginProcessing() { if (base.InvokeAndDisconnect && this.asjob) { throw new InvalidOperationException(RemotingErrorIdStrings.AsJobAndDisconnectedError); } if ((base.InvokeAndDisconnect && ((this.ComputerName == null) || (this.ComputerName.Length == 0))) && ((this.ConnectionUri == null) || (this.ConnectionUri.Length == 0))) { throw new InvalidOperationException(RemotingErrorIdStrings.InvokeDisconnectedWithoutComputerName); } if (base.MyInvocation.BoundParameters.ContainsKey("SessionName") && !base.InvokeAndDisconnect) { throw new InvalidOperationException(RemotingErrorIdStrings.SessionNameWithoutInvokeDisconnected); } if (base.ParameterSetName.Equals("InProcess")) { if (this.FilePath != null) { this.ScriptBlock = base.GetScriptBlockFromFile(this.FilePath, false); } if (base.MyInvocation.ExpectingInput && !this.ScriptBlock.IsUsingDollarInput()) { try { this.steppablePipeline = this.ScriptBlock.GetSteppablePipeline(); this.steppablePipeline.Begin(this); } catch (InvalidOperationException) { } } } else { base.BeginProcessing(); foreach (IThrottleOperation operation in base.Operations) { this.inputWriters.Add(((ExecutionCmdletHelper)operation).Pipeline.Input); } if (base.ParameterSetName.Equals("Session")) { long instanceId = ((LocalRunspace)base.Context.CurrentRunspace).GetCurrentlyRunningPipeline().InstanceId; foreach (PSSession session in this.Session) { RemoteRunspace runspace = (RemoteRunspace)session.Runspace; if (runspace.IsAnotherInvokeCommandExecuting(this, instanceId)) { if (((base.MyInvocation != null) && (base.MyInvocation.PipelinePosition == 1)) && !base.MyInvocation.ExpectingInput) { PSPrimitiveDictionary dictionary = session.ApplicationPrivateData["PSVersionTable"] as PSPrimitiveDictionary; if (dictionary != null) { Version version = dictionary["PSRemotingProtocolVersion"] as Version; if ((version != null) && (version >= RemotingConstants.ProtocolVersionWin8RTM)) { this.needToCollect = false; this.needToStartSteppablePipelineOnServer = true; break; } } } this.needToCollect = true; this.needToStartSteppablePipelineOnServer = false; break; } } } if (this.needToStartSteppablePipelineOnServer) { foreach (IThrottleOperation operation2 in base.Operations) { ExecutionCmdletHelperRunspace runspace2 = operation2 as ExecutionCmdletHelperRunspace; if (runspace2 == null) { break; } runspace2.ShouldUseSteppablePipelineOnServer = true; } } else { this.clearInvokeCommandOnRunspace = true; } this.DetermineThrowStatementBehavior(); } }