protected override void ProcessRecord() { RunspaceSettings settings = new RunspaceSettings(); if (this.PoolSize != 0) { settings.PoolSize = this.PoolSize; } if (this.ApartmentState != System.Threading.ApartmentState.Unknown) { settings.ApartmentState = this.ApartmentState; } if (this.CleanupInterval != null) { settings.CleanupInterval = (TimeSpan)this.CleanupInterval; } if (this.ThreadOptions != PSThreadOptions.Default) { settings.ThreadOptions = this.ThreadOptions; } if (this.Modules != null) { settings.InitialSessionState.ImportPSModule(this.Modules); } PSRunspace.Instance.LoadSettings(settings, this.Host); if (this.PassThru.IsPresent) { WriteObject(settings); } }
public void LoadSettings(RunspaceSettings settings, PSHost host) { if (!this.IsOpen) { this.pool = settings.ToPool(host); } }