public static bool StartProcessInSessionWait(int sessionId, string cmdLine) { try { using (Process p = StartProcessInSession(sessionId, cmdLine)) { p.WaitForExit(); // trow exception if error } } catch { return false; } return true; }