/// <summary> /// Query 'ps' command for a list of processes /// </summary> private bool PSListProcess(string username, out string errorMessage, out List <Process> processes) { errorMessage = string.Empty; string commandOutput; int exitCode; if (!ExecuteCommand(PSOutputParser.PSCommandLine, Timeout.Infinite, false, out commandOutput, out errorMessage)) { // Clear output and errorMessage commandOutput = string.Empty; errorMessage = string.Empty; if (!ExecuteCommand(PSOutputParser.AltPSCommandLine, Timeout.Infinite, false, out commandOutput, out errorMessage, out exitCode)) { if (exitCode == 127) { //command doesn't Exist errorMessage = StringResources.Error_PSMissing; } else { errorMessage = StringResources.Error_PSErrorFormat.FormatCurrentCultureWithArgs(exitCode, errorMessage); } processes = null; return(false); } } processes = PSOutputParser.Parse(commandOutput, username); return(true); }
public AD7Process(AD7Port port, PSOutputParser.Process psProcess) { _port = port; _processId = psProcess.Id; _commandLine = psProcess.CommandLine; _userName = psProcess.UserName; _isSameUser = psProcess.IsSameUser; }
internal List <PSOutputParser.Process> ListProcesses() { var command = _remoteSystem.Shell.ExecuteCommand(PSOutputParser.CommandText); if (command.ExitCode != 0) { throw new CommandFailedException(StringResources.Error_PSFailed); } return(PSOutputParser.Parse(command.Output)); }
public override List <Process> ListProcesses() { string username; TryGetUsername(out username); string commandOutput; if (!ExecuteCommand(PSOutputParser.PSCommandLine, Timeout.Infinite, false, out commandOutput)) { if (!ExecuteCommand(PSOutputParser.AltPSCommandLine, Timeout.Infinite, false, out commandOutput)) { throw new CommandFailedException(StringResources.Error_PSFailed); } } return(PSOutputParser.Parse(commandOutput, username)); }
public static List<Process> Parse(string output) { var @this = new PSOutputParser(); return @this.ParseInternal(output); }
public static List <Process> Parse(string output) { var @this = new PSOutputParser(); return(@this.ParseInternal(output)); }