public WindowsPS(ConfigService configService) { ConfigService = configService; var psi = new ProcessStartInfo("powershell.exe") { WindowStyle = ProcessWindowStyle.Hidden, Verb = "RunAs", RedirectStandardError = true, RedirectStandardInput = true, RedirectStandardOutput = true }; PSProc = new Process { StartInfo = psi, EnableRaisingEvents = true }; PSProc.ErrorDataReceived += CMDProc_ErrorDataReceived; PSProc.OutputDataReceived += CMDProc_OutputDataReceived; PSProc.Start(); PSProc.BeginErrorReadLine(); PSProc.BeginOutputReadLine(); ProcessIdleTimeout = new System.Timers.Timer(600_000) { AutoReset = false }; // 10 minutes. ProcessIdleTimeout.Elapsed += ProcessIdleTimeout_Elapsed; ProcessIdleTimeout.Start(); }
public Bash(ConfigService configService) { ConfigService = configService; var psi = new ProcessStartInfo("bash"); psi.WindowStyle = ProcessWindowStyle.Hidden; psi.Verb = "RunAs"; psi.UseShellExecute = false; psi.RedirectStandardError = true; psi.RedirectStandardInput = true; psi.RedirectStandardOutput = true; BashProc = new Process(); BashProc.StartInfo = psi; BashProc.ErrorDataReceived += CMDProc_ErrorDataReceived; BashProc.OutputDataReceived += CMDProc_OutputDataReceived; BashProc.Start(); BashProc.BeginErrorReadLine(); BashProc.BeginOutputReadLine(); ProcessIdleTimeout = new System.Timers.Timer(600_000); // 10 minutes. ProcessIdleTimeout.AutoReset = false; ProcessIdleTimeout.Elapsed += ProcessIdleTimeout_Elapsed; ProcessIdleTimeout.Start(); }
public CMD(ConfigService configService) { ConfigService = configService; var psi = new ProcessStartInfo("cmd.exe") { WindowStyle = ProcessWindowStyle.Hidden, Verb = "RunAs", UseShellExecute = false, RedirectStandardError = true, RedirectStandardInput = true, RedirectStandardOutput = true }; CMDProc = new Process { StartInfo = psi }; CMDProc.ErrorDataReceived += CMDProc_ErrorDataReceived; CMDProc.OutputDataReceived += CMDProc_OutputDataReceived; CMDProc.Start(); CMDProc.BeginErrorReadLine(); CMDProc.BeginOutputReadLine(); ProcessIdleTimeout = new System.Timers.Timer(600_000) { AutoReset = false }; // 10 minutes. ProcessIdleTimeout.Elapsed += ProcessIdleTimeout_Elapsed; ProcessIdleTimeout.Start(); }
public PSCore(ConfigService configService) { ConfigService = configService; PS = PowerShell.Create(); PS.AddScript(@"$VerbosePreference = ""Continue""; $DebugPreference = ""Continue""; $InformationPreference = ""Continue""; $WarningPreference = ""Continue"";"); PS.Invoke(); ProcessIdleTimeout = new Timer(600_000); // 10 minutes. ProcessIdleTimeout.AutoReset = false; ProcessIdleTimeout.Elapsed += ProcessIdleTimeout_Elapsed; ProcessIdleTimeout.Start(); }