Hello, here is your code modified according to my previous answer. Please use it as a starting point for your new code as you know what needs to be done, not as a complete solution.
using (var ssh = new Rebex.Net.Ssh())
// if ssh connection time out after 40 minutes, this timeout should be raised or set to -1
ssh.Timeout = 40 * 60 * 1000;
Scripting scripting = ssh.StartScripting();
// set prompt to enable using ScriptEvent.Prompt
scripting.Prompt = "#";
// execute long running silent command
// 30 seconds chunk
ScriptEvent workInProgress = ScriptEvent.Duration(30 * 1000);
// try to receive prompt in 30 seconds chunks, so the scripting should not time out
match = scripting.WaitFor(workInProgress, ScriptEvent.Prompt);
} while (!match.IsPrompt);
// now the command is finished and prompt should have been received
// ... do some additional work ...