USING SSH -> Invoke-SSHCommand to send Keystroke for Sophos Firewal Bash Menu

Hey Guys,

maybe someone of you can help me. I Want to get on the Sophos Firewall Shell via Powershell Invoke-SSHCommand.

My Problem is, the Sophos Firewall starts with a Bash Menu (Linux Based action Menu) I need to send the Keystroke 5 and 3 to start the shell.

Is there a way to send these Keystroke over Invoke-SSHCommand -SessionId X -Command {…?}
To Type the Number in Command Bracket doesn’t work:

Invoke-SSHCommand -SessionId 1 -Command {5}
Invoke-SSHCommand -SessionId 1 -Command {3}

Host : X.X.X.X
Output : {% Error: Unknown Parameter ‘5’}
ExitStatus : 0

Host : X.X.X.X
Output : {% Error: Unknown Parameter ‘3’}
ExitStatus : 0

BR
Patrick

If I understand your question correctly, you want to start a bash shell in your PowerShell console? I am not sure if Invoke-SSHCommand is the right tool for this job. PowerShell Core provides awesome support for SSH using New-PSSession, Enter-PSSession, Invoke-Command. If I am wrong or misunderstanding, I apologize, but take a look at Microsoft’s docs about using SSH in PowerShell Core.

https://docs.microsoft.com/en-us/powershell/scripting/learn/remoting/ssh-remoting-in-powershell-core?view=powershell-6

pwshliquori