# Run an interactive SSH command

Run an interactive SSH command on Evotec with practical examples, usage guidance, and reusable project workflows.

Project

Transferetto

Small PowerShell module with FTPS/SFTP functionality

[View on GitHub](https://github.com/EvotecIT/Transferetto) [Visit Website](#) [Releases](https://github.com/EvotecIT/Transferetto/releases/tag/Transferetto-v2.0.0) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/Transferetto)

Stars**93**

Forks**18**

Open issues**0**

PowerShell Gallery downloads**14067470**

Release**v2.0.4**

Language: C# Updated: 2026-11-17

Curated Examples

Use Transferetto to open a prompt-aware SSH shell and return structured command output.

This pattern is useful when a server-management step needs more than a one-shot command and should work through an interactive shell with prompt detection.

It is adapted from the source example at `Examples/Example24-SSHShellPromptAndCommand.ps1`.

## When to use this pattern

- You need a reusable interactive shell session.
- The target host uses a predictable prompt pattern.
- You want structured output, including the command result object.

## Example

```powershell
Import-Module Transferetto

$sshClient = Connect-SSH -Server 'server.example.com' -Credential (Get-Credential)
$shell = New-SSHShell -SshClient $sshClient -PromptPattern '(?m)^[^@\r\n]+@[^:\r\n]+:[^\r\n]*[$#]\s?$'

Wait-SSHShellPrompt -ShellSession $shell -TimeoutSeconds 5 | Out-Null

$result = Invoke-SSHShellCommand -ShellSession $shell -Command 'pwd && whoami'
$result | Format-List

Close-SSHShell -ShellSession $shell
Disconnect-SSH -SshClient $sshClient
```

## What this demonstrates

- opening a prompt-aware interactive shell
- waiting until the prompt is ready before sending work
- running a shell command and returning a structured result

## Source

- [Example24-SSHShellPromptAndCommand.ps1](https://github.com/EvotecIT/Transferetto/blob/master/Examples/Example24-SSHShellPromptAndCommand.ps1)

<!-- PowerForge markdown artifact sha256:95C24F21B93DA19B797DA951DFEDA57A0426AA4782B4F6D9D116E83120F64BE4 -->
