Example #1
0
 /// <summary>
 /// Executes this instance.
 /// </summary>
 /// <returns></returns>
 public PsExecutionResult Execute()
 {
     PsExecutionResult result = new PsExecutionResult(); PipelineExecutor pexec = new PipelineExecutor(); string opResult = string.Empty;  try { result.ResultMessage = pexec.RunScriptReturnStr((HyperV.Definitions.HypervCommands[(int)this.Command]).ToString(), this._Parameters, this._iss); result.Success = true; }             catch (Exception ex) { result.Success = false; result.ResultMessage = string.Format("Error executing the command {0} for the VM {1} with the parameters {2}", this.Command.ToString(), this._VmName, string.Join(",", _Parameters.Select(kv => kv.Key.ToString() + "=" + kv.Value.ToString()).ToArray())); result.Exception = ex; ExceptionManager.HandleException(ex); }             finally { pexec = null; } return(result);
 }
Example #2
0
 /// <summary>
 /// Executes this instance.
 /// </summary>
 /// <returns></returns>
 public PsExecutionResult Execute()
 {
     PsExecutionResult result = new PsExecutionResult(); PipelineExecutor pexec = new PipelineExecutor(); string opResult = string.Empty;  try { result.ResultMessage = pexec.RunScriptReturnStr((HyperV.Definitions.HypervCommands[(int)this.Command]).ToString(), this._Parameters, this._iss); result.Success = true; }             catch (Exception ex) { result.Success = false; result.ResultMessage = string.Format("Error executing the command {0} for the VM {1} with the parameters {2}", this.Command.ToString(), this._VmName, string.Join(",", _Parameters.Select(kv => kv.Key.ToString() + "=" + kv.Value.ToString()).ToArray())); result.Exception = ex; ExceptionManager.HandleException(ex); }             finally { pexec = null; } return result;
 }