ShellPromptExpression Parameter (Invoke-SSH Cmdlet)
A regular expression to match the shell prompt returned by the server.
Invoke-SSH -ShellPromptExpression string
If ShellPromptExpression is specified, the cmdlet will not use the SEXEC protocol, but instead will just request shell access and wait until a shell prompt that matches the specified regular expression come up. Commands will then be executed through the shell instead of the SExec mechanism, which allows multiple commands sent over a single connection to share state on the server.
Note: The value specified in ShellPromptExpression must be a properly formatted regular expression.