Skip to content

Add documentation for new -ConnectingTimeout parameter for SSH remoting #7464

@PaulHigin

Description

@PaulHigin

Summary of the new document or enhancement

A new -ConnectingTimeout parameter has been added to remoting cmdlets SSH transport parameter sets.

Description of what changed

-ConnectingTimeout parameter takes an integer value that defines the amount of time, in milliseconds, allowed for the initial SSH connection to complete. If the connection does not complete within this time, an error is thrown. This new parameter applies only to SSH connections and appears only for SSH parameter sets.

Affected cmdlets:

New-PSSession
Enter-PSSession
Invoke-Command

Affected parameter sets:

New-PSSession [-HostName] <string[]> [-Name <string[]>] [-Port <int>] [-UserName <string>] [-KeyFilePath <string>] [-Subsystem <string>] [-ConnectingTimeout <int>] [-SSHTransport] [<CommonParameters>]
New-PSSession -SSHConnection <hashtable[]> [-Name <string[]>] [<CommonParameters>]
Enter-PSSession [-HostName] <string> [-Port <int>] [-UserName <string>] [-KeyFilePath <string>] [-Subsystem <string>] [-ConnectingTimeout <int>] [-SSHTransport] [<CommonParameters>]
Invoke-Command [-ScriptBlock] <scriptblock> -HostName <string[]> [-Port <int>] [-AsJob] [-HideComputerName] [-JobName <string>] [-UserName <string>] [-KeyFilePath <string>] [-Subsystem <string>] [-ConnectingTimeout <int>] [-SSHTransport] [-RemoteDebug] [-InputObject <psobject>] [-ArgumentList <Object[]>] [<CommonParameters>]
Invoke-Command [-ScriptBlock] <scriptblock> -SSHConnection <hashtable[]> [-AsJob] [-HideComputerName] [-JobName <string>] [-RemoteDebug] [-InputObject <psobject>] [-ArgumentList <Object[]>] [<CommonParameters>]
Invoke-Command -FilePath <string> -HostName <string[]> [-AsJob] [-HideComputerName] [-UserName <string>] [-KeyFilePath <string>] [-Subsystem <string>] [-ConnectingTimeout <int>] [-SSHTransport] [-RemoteDebug] [-InputObject <psobject>] [-ArgumentList <Object[]>] [<CommonParameters>]
Invoke-Command -FilePath <string> -SSHConnection <hashtable[]> [-AsJob] [-HideComputerName] [-RemoteDebug] [-InputObject <psobject>] [-ArgumentList <Object[]>] [<CommonParameters>]

Examples:

New-PSSession -HostName localhost -ConnectingTimeout 5000
New-PSSession: [localhost] SSH connection attempt failed after time out: 5 seconds.

$connectionHash = @{ HostName='localhost'; ConnectingTimeout=5000 }
New-PSSession -SSHConnection $connectionHash
New-PSSession: [localhost] SSH connection attempt failed after time out: 5 seconds.
Enter-PSSession -HostName localhost -ConnectingTimeout 5000
Enter-PSSession: SSH connection attempt failed after time out: 5 seconds.
Invoke-Command -HostName localhost -ScriptBlock { 'Hello' } -ConnectingTimeout 5000
OpenError: [localhost] SSH connection attempt failed after time out: 5 seconds.

$connectionHash = @{ HostName='localhost'; ConnectingTimeout=5000 }
Invoke-Command -SSHConnection $connectionHash -ScriptBlock { 'Hello' }
OpenError: [localhost] SSH connection attempt failed after time out: 5 seconds.

Metadata

Metadata

Assignees

Labels

area-remotingArea - PowerShell remoting

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions