public void QueryVCESXBuildAsync(String vcServer) { if (vCenterCount != 0) { WaitQueue.Enqueue(vcServer); } else { try { this.StopScript(); this.CreateRunspace(); StringBuilder sbConnectVIServer = new StringBuilder(); sbConnectVIServer.AppendFormat("Connect-VIServer {0}\n Get-VMHost", vcServer); Console.Error.WriteLine("Starting PowerCLI command"); pipelineExecutor = new PipelineExecutor(run, this.invoker, sbConnectVIServer.ToString()); pipelineExecutor.OnDataReady += new PipelineExecutor.DataReadyDelegate(pipelineExecutor_OnDataReady); pipelineExecutor.OnDataEnd += new PipelineExecutor.DataEndDelegate(pipelineExecutor_OnDataEnd); pipelineExecutor.OnErrorReady += new PipelineExecutor.ErrorReadyDelegate(pipelineExecutor_OnErrorReady); pipelineExecutor.Start(); vCenterCount = 1; } catch (Exception e) { Console.Error.WriteLine("Stack Trace: {0}, Message: {1}", e.StackTrace, e.Message); } } }
public void QueryVCBuildAsync(String vcServer) { StringBuilder sbConnectVIServer = new StringBuilder(); sbConnectVIServer.AppendFormat("Connect-VIServer {0}", vcServer); pipelineExecutor = new PipelineExecutor(run, this.invoker, sbConnectVIServer.ToString()); pipelineExecutor.OnDataReady += new PipelineExecutor.DataReadyDelegate(pipelineExecutor_OnDataReady); pipelineExecutor.OnDataEnd += new PipelineExecutor.DataEndDelegate(pipelineExecutor_OnDataEnd); pipelineExecutor.OnErrorReady += new PipelineExecutor.ErrorReadyDelegate(pipelineExecutor_OnErrorReady); pipelineExecutor.Start(); }