Example #1
0
        internal PowerShell GetAssociatedPowerShellObject(Guid runspaceInstanceId)
        {
            PowerShell         powerShell = null;
            PSRemotingChildJob job        = this.FindDisconnectedChildJob(runspaceInstanceId);

            if (job != null)
            {
                powerShell = job.GetPowerShell();
            }
            return(powerShell);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
        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);
            }
        }
Example #5
0
 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);
 }
Example #6
0
        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);
        }
Example #7
0
 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);
 }
Example #8
0
 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);
 }
Example #9
0
 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);
     }
 }
Example #10
0
 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);
     }
 }
Example #11
0
 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);
     }
 }
Example #12
0
 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();
 }
Example #13
0
 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();
 }
Example #14
0
 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);
     }
 }
Example #15
0
 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);
     }
 }
Example #16
0
 internal ConnectJobOperation(PSRemotingChildJob job)
 {
     this.psRemoteChildJob = job;
     this.psRemoteChildJob.StateChanged += new EventHandler <JobStateEventArgs>(this.ChildJobStateChangedHandler);
 }
Example #17
0
 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);
 }
Example #18
0
 internal ConnectJobOperation(PSRemotingChildJob job)
 {
     this.psRemoteChildJob = job;
     this.psRemoteChildJob.StateChanged += new EventHandler<JobStateEventArgs>(this.ChildJobStateChangedHandler);
 }