Exemple #1
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            ScriptBlock sc = this.ScriptBlock;

            if (!string.IsNullOrEmpty(this.FilePath))
            { sc = ScriptBlock.Create(this.FilePath); }

            if (this.InitializationScript != null)
            { sc = ScriptBlock.Create(this.InitializationScript.ToString() + sc.ToString()); }
            AsyncJob job;

            if (this.ArgumentList != null)
            { job = new AsyncJob(sc, this.ArgumentList); }
            if (this.Parameters != null)
            { job = new AsyncJob(sc, this.Parameters); }
            else
            { job = new AsyncJob(sc); }
            job.Name = this.Name;
            PSRunspace.Instance.AddJob(job);
            WriteObject(job);
        }
Exemple #2
0
 public void AddJob(AsyncJob Job)
 { this.JobQueue.TryAdd(Job.InstanceId, Job); }