internal PowerShell GetAssociatedPowerShellObject(Guid runspaceInstanceId) { PowerShell powerShell = null; PSRemotingChildJob job = this.FindDisconnectedChildJob(runspaceInstanceId); if (job != null) { powerShell = job.GetPowerShell(); } return(powerShell); }
internal List <Job> GetJobsForComputer(string computerName) { List <Job> list = new List <Job>(); foreach (Job job in base.ChildJobs) { PSRemotingChildJob item = job as PSRemotingChildJob; if ((job != null) && string.Equals(item.Runspace.ConnectionInfo.ComputerName, computerName, StringComparison.OrdinalIgnoreCase)) { list.Add(item); } } return(list); }
internal List <Job> GetJobsForRunspace(PSSession runspace) { List <Job> list = new List <Job>(); foreach (Job job in base.ChildJobs) { PSRemotingChildJob item = job as PSRemotingChildJob; if ((job != null) && item.Runspace.InstanceId.Equals(runspace.InstanceId)) { list.Add(item); } } return(list); }
internal void ConnectJob(Guid runspaceInstanceId) { List <IThrottleOperation> connectJobOperations = new List <IThrottleOperation>(); PSRemotingChildJob job = this.FindDisconnectedChildJob(runspaceInstanceId); if (job != null) { connectJobOperations.Add(new ConnectJobOperation(job)); } if (connectJobOperations.Count != 0) { this.SubmitAndWaitForConnect(connectJobOperations); } }
internal PSRemotingJob(string[] computerNames, List <IThrottleOperation> computerNameHelpers, string remoteCommand, int throttleLimit, string name) : base(remoteCommand, name) { this.moreData = true; this.hideComputerName = true; this.throttleManager = new ThrottleManager(); this._syncObject = new object(); foreach (ExecutionCmdletHelperComputerName name2 in computerNameHelpers) { PSRemotingChildJob item = new PSRemotingChildJob(remoteCommand, name2, this.throttleManager); item.StateChanged += new EventHandler <JobStateEventArgs>(this.HandleChildJobStateChanged); item.JobUnblocked += new EventHandler(this.HandleJobUnblocked); base.ChildJobs.Add(item); } this.CommonInit(throttleLimit, computerNameHelpers); }
internal List <Job> GetJobsForOperation(IThrottleOperation operation) { List <Job> list = new List <Job>(); ExecutionCmdletHelper helper = operation as ExecutionCmdletHelper; foreach (Job job in base.ChildJobs) { PSRemotingChildJob item = job as PSRemotingChildJob; if ((job != null) && item.Helper.Equals(helper)) { list.Add(item); } } return(list); }
internal PSRemotingJob(PSSession[] remoteRunspaceInfos, List <IThrottleOperation> runspaceHelpers, string remoteCommand, int throttleLimit, string name) : base(remoteCommand, name) { this.moreData = true; this.hideComputerName = true; this.throttleManager = new ThrottleManager(); this._syncObject = new object(); for (int i = 0; i < remoteRunspaceInfos.Length; i++) { ExecutionCmdletHelperRunspace helper = (ExecutionCmdletHelperRunspace)runspaceHelpers[i]; PSRemotingChildJob item = new PSRemotingChildJob(remoteCommand, helper, this.throttleManager); item.StateChanged += new EventHandler <JobStateEventArgs>(this.HandleChildJobStateChanged); item.JobUnblocked += new EventHandler(this.HandleJobUnblocked); base.ChildJobs.Add(item); } this.CommonInit(throttleLimit, runspaceHelpers); }
internal PSRemotingJob(PSSession[] remoteRunspaceInfos, List<IThrottleOperation> runspaceHelpers, string remoteCommand, int throttleLimit, string name) : base(remoteCommand, name) { this.moreData = true; this.hideComputerName = true; this.throttleManager = new ThrottleManager(); this._syncObject = new object(); for (int i = 0; i < remoteRunspaceInfos.Length; i++) { ExecutionCmdletHelperRunspace helper = (ExecutionCmdletHelperRunspace) runspaceHelpers[i]; PSRemotingChildJob item = new PSRemotingChildJob(remoteCommand, helper, this.throttleManager); item.StateChanged += new EventHandler<JobStateEventArgs>(this.HandleChildJobStateChanged); item.JobUnblocked += new EventHandler(this.HandleJobUnblocked); base.ChildJobs.Add(item); } this.CommonInit(throttleLimit, runspaceHelpers); }
internal List <Job> GetJobsForComputer(string computerName) { using (PSRemotingJob.tracer.TraceMethod()) { List <Job> jobList = new List <Job>(); foreach (Job childJob in (IEnumerable <Job>) this.ChildJobs) { PSRemotingChildJob remotingChildJob = childJob as PSRemotingChildJob; if (childJob != null && string.Equals(remotingChildJob.Runspace.ConnectionInfo.ComputerName, computerName, StringComparison.OrdinalIgnoreCase)) { jobList.Add((Job)remotingChildJob); } } return(jobList); } }
internal List <Job> GetJobsForRunspace(PSSession runspace) { using (PSRemotingJob.tracer.TraceMethod()) { List <Job> jobList = new List <Job>(); foreach (Job childJob in (IEnumerable <Job>) this.ChildJobs) { PSRemotingChildJob remotingChildJob = childJob as PSRemotingChildJob; if (childJob != null && remotingChildJob.Runspace.InstanceId.Equals(runspace.InstanceId)) { jobList.Add((Job)remotingChildJob); } } return(jobList); } }
internal List <Job> GetJobsForOperation(IThrottleOperation operation) { using (PSRemotingJob.tracer.TraceMethod()) { List <Job> jobList = new List <Job>(); ExecutionCmdletHelper executionCmdletHelper = operation as ExecutionCmdletHelper; foreach (Job childJob in (IEnumerable <Job>) this.ChildJobs) { PSRemotingChildJob remotingChildJob = childJob as PSRemotingChildJob; if (childJob != null && remotingChildJob.Helper.Equals((object)executionCmdletHelper)) { jobList.Add((Job)remotingChildJob); } } return(jobList); } }
internal PSRemotingJob(List<IThrottleOperation> helpers, int throttleLimit, string name, bool aggregateResults) : base(string.Empty, name) { this.moreData = true; this.hideComputerName = true; this.throttleManager = new ThrottleManager(); this._syncObject = new object(); foreach (ExecutionCmdletHelper helper in helpers) { PSRemotingChildJob item = new PSRemotingChildJob(helper, this.throttleManager, aggregateResults); item.StateChanged += new EventHandler<JobStateEventArgs>(this.HandleChildJobStateChanged); item.JobUnblocked += new EventHandler(this.HandleJobUnblocked); base.ChildJobs.Add(item); } base.CloseAllStreams(); base.SetJobState(JobState.Disconnected); this.throttleManager.ThrottleLimit = throttleLimit; this.throttleManager.SubmitOperations(helpers); this.throttleManager.EndSubmitOperations(); }
internal PSRemotingJob(List <IThrottleOperation> helpers, int throttleLimit, string name, bool aggregateResults) : base(string.Empty, name) { this.moreData = true; this.hideComputerName = true; this.throttleManager = new ThrottleManager(); this._syncObject = new object(); foreach (ExecutionCmdletHelper helper in helpers) { PSRemotingChildJob item = new PSRemotingChildJob(helper, this.throttleManager, aggregateResults); item.StateChanged += new EventHandler <JobStateEventArgs>(this.HandleChildJobStateChanged); item.JobUnblocked += new EventHandler(this.HandleJobUnblocked); base.ChildJobs.Add(item); } base.CloseAllStreams(); base.SetJobState(JobState.Disconnected); this.throttleManager.ThrottleLimit = throttleLimit; this.throttleManager.SubmitOperations(helpers); this.throttleManager.EndSubmitOperations(); }
internal PSRemotingJob( string[] computerNames, List <IThrottleOperation> computerNameHelpers, string remoteCommand, int throttleLimit, string name) : base(remoteCommand, name) { using (PSRemotingJob.tracer.TraceConstructor((object)this)) { foreach (ExecutionCmdletHelperComputerName computerNameHelper in computerNameHelpers) { PSRemotingChildJob remotingChildJob = new PSRemotingChildJob(remoteCommand, (ExecutionCmdletHelper)computerNameHelper, this.throttleManager); remotingChildJob.StateChanged += new EventHandler <JobStateEventArgs>(this.HandleChildJobStateChanged); remotingChildJob.JobUnblocked += new EventHandler(this.HandleJobUnblocked); this.ChildJobs.Add((Job)remotingChildJob); } this.CommonInit(throttleLimit, computerNameHelpers); } }
internal PSRemotingJob( PSSession[] remoteRunspaceInfos, List <IThrottleOperation> runspaceHelpers, string remoteCommand, int throttleLimit, string name) : base(remoteCommand, name) { using (PSRemotingJob.tracer.TraceConstructor((object)this)) { for (int index = 0; index < remoteRunspaceInfos.Length; ++index) { ExecutionCmdletHelperRunspace runspaceHelper = (ExecutionCmdletHelperRunspace)runspaceHelpers[index]; PSRemotingChildJob remotingChildJob = new PSRemotingChildJob(remoteCommand, (ExecutionCmdletHelper)runspaceHelper, this.throttleManager); remotingChildJob.StateChanged += new EventHandler <JobStateEventArgs>(this.HandleChildJobStateChanged); remotingChildJob.JobUnblocked += new EventHandler(this.HandleJobUnblocked); this.ChildJobs.Add((Job)remotingChildJob); } this.CommonInit(throttleLimit, runspaceHelpers); } }
internal ConnectJobOperation(PSRemotingChildJob job) { this.psRemoteChildJob = job; this.psRemoteChildJob.StateChanged += new EventHandler <JobStateEventArgs>(this.ChildJobStateChangedHandler); }
internal PSRemotingJob(string[] computerNames, List<IThrottleOperation> computerNameHelpers, string remoteCommand, int throttleLimit, string name) : base(remoteCommand, name) { this.moreData = true; this.hideComputerName = true; this.throttleManager = new ThrottleManager(); this._syncObject = new object(); foreach (ExecutionCmdletHelperComputerName name2 in computerNameHelpers) { PSRemotingChildJob item = new PSRemotingChildJob(remoteCommand, name2, this.throttleManager); item.StateChanged += new EventHandler<JobStateEventArgs>(this.HandleChildJobStateChanged); item.JobUnblocked += new EventHandler(this.HandleJobUnblocked); base.ChildJobs.Add(item); } this.CommonInit(throttleLimit, computerNameHelpers); }
internal ConnectJobOperation(PSRemotingChildJob job) { this.psRemoteChildJob = job; this.psRemoteChildJob.StateChanged += new EventHandler<JobStateEventArgs>(this.ChildJobStateChangedHandler); }