Connect-SSHCmdlet

Parameters   Output Objects   Config Settings  

The Connect-SSH cmdlet is used to create a persistent connection object.

Syntax

$cnn = Connect-SSH [parameters]

Remarks

This cmdlet allows you to create a persistent connection object to be used with related cmdlets.

When executing the cmdlet a connection object is returned. Pass this object to the Connection parameter of related cmdlets to use the newly created connection object.

To disconnect call Disconnect-SSH.

Parameter List


The following is the full list of the parameters of the cmdlet with short descriptions. Click on the links for further details.

LogFileThe location of a file to which debug information is written.
AuthModeThe type of authentication used by the component.
CertPasswordThe password to the certificate store.
CertStoreThe name of the certificate store for the client certificate.
CertStoreTypeThe type of certificate store for the client certificate.
CertSubjectThe subject of the certificate used for client authentication.
CompressionAlgorithmsA comma-separated list containing all allowable compression algorithms.
ConfigSpecifies one or more configuration settings.
CredentialThe PSCredential object to use for user/password authentication.
EncryptionAlgorithmsA comma-separated list containing all allowable compression algorithms.
FirewallHostName or IP address of firewall.
FirewallPasswordA password if authentication is to be used when connecting through the firewall.
FirewallPortThe port of the firewall to which to connect.
FirewallTypeDetermines the type of firewall to connect through.
FirewallUserA user name if authentication is to be used connecting through a firewall.
ForceForces the component to accept the default behavior instead of querying the user.
LocalIPThe IP address of the local interface to use.
LogFileThe location of a file to which debug information is written.
PasswordThe password to use for authentication.
PasswordPromptThe shell prompt used for keyboard-interactive authentication.
PortThe port to be used.
ServerThe address of the Server.
ShellPromptSpecifies the shell prompt to wait for.
ShellPromptExpressionA regular expression to match the shell prompt returned by the server.
SSHAcceptThe hex-encoded fingerprint of the host to trust explicitly.
TimeoutThe maximum time allowed for the operation.
UserThe username to use for authentication.

Output Objects


The following is the full list of the output objects returned by the cmdlet with short descriptions. Click on the links for further details.

SSHConnectionThe connection object.

Config Settings


The following is a list of config settings for the cmdlet with short descriptions. Click on the links for further details.

EnableEchoWhether the commands sent to the server should be echoed.
SexecExitStatusVarThe name of a variable to store the exit status of a command executed via the SExec protocol.
TerminalHeightThe height of the terminal display.
TerminalUsePixelWhether the terminal's dimensions are in columns/rows or pixels.
TerminalWidthThe width of the terminal display.
DisconnectOnChannelCloseWhether to automatically close the connection when a channel is closed.
EncodedTerminalModesThe terminal mode to set when communicating with the SSH host.
StdInFileThe file to use as Stdin data.
TerminalHeightThe height of the terminal display.
TerminalModesThe terminal mode to set when communicating with the SSH host.
TerminalUsePixelWhether the terminal's dimensions are in columns/rows or pixels.
TerminalWidthThe width of the terminal display.
UseTerminalWhether to executes commands within a pseudo-terminal.
ChannelDataEOL[ChannelId]Used to break the incoming data stream into chunks.
ChannelDataEOLFound[ChannelId]Determines if ChannelDataEOL was found.
ClientSSHVersionStringThe SSH version string used by the component.
EnablePageantAuthWhether to use a key stored in Pageant to perform client authentication.
KerberosDelegationIf true, asks for credentials with delegation enabled during authentication.
KerberosRealmThe fully qualified domain name of the Kerberos Realm to use for GSSAPI authentication.
KerberosSPNThe Kerberos Service Principal Name of the SSH host.
KeyRenegotiationThresholdSets the threshold for the SSH Key Renegotiation.
LogLevelSpecifies the level of detail that is logged.
MaxChannelDataLength[ChannelId]The maximum amount of data to accumulate when no ChannelDataEOL is found.
MaxPacketSizeThe maximum packet size of the channel, in bytes.
MaxWindowSizeThe maximum window size allowed for the channel, in bytes.
PasswordPromptThe text of the password prompt used in keyboard-interactive authentication.
PreferredDHGroupBitsThe size (in bits) of the preferred modulus (p) to request from the server.
RecordLengthThe length of received data records.
ServerSSHVersionStringThe remote host's SSH version string.
SignedSSHCertThe CA signed client public key used when authenticating.
SSHAcceptAnyServerHostKeyIf set the component will accept any key presented by the server.
SSHAcceptServerCAKeyThe CA public key that signed the server's host key.
SSHAcceptServerHostKeyFingerPrintThe fingerprint of the server key to accept.
SSHFingerprintHashAlgorithmThe algorithm used to calculate the fingerprint.
SSHFingerprintMD5The server hostkey's MD5 fingerprint.
SSHFingerprintSHA1The server hostkey's SHA1 fingerprint.
SSHFingerprintSHA256The server hostkey's SHA256 fingerprint.
SSHKeepAliveCountMaxThe maximum number of keep alive packets to send without a response.
SSHKeepAliveIntervalThe interval between keep alive packets.
SSHKeyExchangeAlgorithmsSpecifies the supported key exchange algorithms.
SSHKeyRenegotiateCauses the component to renegotiate the SSH keys.
SSHMacAlgorithmsSpecifies the supported Mac algorithms.
SSHPubKeyAuthSigAlgorithmsSpecifies the enabled signature algorithms that may be used when attempting public key authentication.
SSHPublicKeyAlgorithmsSpecifies the supported public key algorithms for the server's public key.
SSHVersionPatternThe pattern used to match the remote host's version string.
TryAllAvailableAuthMethodsIf set to true, the component will try all available authentication methods.
UseStrictKeyExchangeSpecifies how strict key exchange is supported.
WaitForChannelCloseWhether to wait for channels to be closed before disconnected.
WaitForServerDisconnectWhether to wait for the server to close the connection.
ConnectionTimeoutSets a separate timeout value for establishing a connection.
FirewallAutoDetectTells the component whether or not to automatically detect and use firewall system settings, if available.
FirewallHostName or IP address of firewall (optional).
FirewallPasswordPassword to be used if authentication is to be used when connecting through the firewall.
FirewallPortThe TCP port for the FirewallHost;.
FirewallTypeDetermines the type of firewall to connect through.
FirewallUserA user name if authentication is to be used connecting through a firewall.
KeepAliveIntervalThe retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received.
KeepAliveTimeThe inactivity time in milliseconds before a TCP keep-alive packet is sent.
LingerWhen set to True, connections are terminated gracefully.
LingerTimeTime in seconds to have the connection linger.
LocalHostThe name of the local host through which connections are initiated or accepted.
LocalPortThe port in the local host where the component binds.
MaxLineLengthThe maximum amount of data to accumulate when no EOL is found.
MaxTransferRateThe transfer rate limit in bytes per second.
ProxyExceptionsListA semicolon separated list of hosts and IPs to bypass when using a proxy.
TCPKeepAliveDetermines whether or not the keep alive socket option is enabled.
TcpNoDelayWhether or not to delay when sending packets.
UseIPv6Whether to use IPv6.
AbsoluteTimeoutDetermines whether timeouts are inactivity timeouts or absolute timeouts.
FirewallDataUsed to send extra data to the firewall.
InBufferSizeThe size in bytes of the incoming queue of the socket.
OutBufferSizeThe size in bytes of the outgoing queue of the socket.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
MaskSensitiveWhether sensitive data is masked in log messages.
UseInternalSecurityAPITells the component whether or not to use the system security libraries or an internal implementation.

LogFile Parameter (Connect-SSH Cmdlet)

The location of a file to which debug information is written.

Syntax

Connect-SSH -LogFile string

Remarks

When specified, the cmdlet will log debug information to the file. If the file exists, the information will be appended.

Default Value

null

AuthMode Parameter (Connect-SSH Cmdlet)

The type of authentication used by the component.

Syntax

Connect-SSH -AuthMode string

Remarks

Default Value

2

CertPassword Parameter (Connect-SSH Cmdlet)

The password to the certificate store.

Syntax

Connect-SSH -CertPassword string

Remarks

Default Value

""

Parameter Alias

CertificatePassword

CertStore Parameter (Connect-SSH Cmdlet)

The name of the certificate store for the client certificate.

Syntax

Connect-SSH -CertStore string

Remarks

Default Value

"MY"

Parameter Alias

CertificateStore

CertStoreType Parameter (Connect-SSH Cmdlet)

The type of certificate store for the client certificate.

Syntax

Connect-SSH -CertStoreType string

Remarks

Default Value

0

CertSubject Parameter (Connect-SSH Cmdlet)

The subject of the certificate used for client authentication.

Syntax

Connect-SSH -CertSubject string

Remarks

Default Value

"*"

Command Parameter (Connect-SSH Cmdlet)

The command to be sent to the server.

Syntax

Connect-SSH -Command string

Remarks

Default Value

""

Parameter Position

2

This is a required parameter.

CompressionAlgorithms Parameter (Connect-SSH Cmdlet)

A comma-separated list containing all allowable compression algorithms.

Syntax

Connect-SSH -CompressionAlgorithms string

Remarks

Default Value

"none"

Config Parameter (Connect-SSH Cmdlet)

Specifies one or more configuration settings.

Syntax

Connect-SSH -Config string[]

Remarks

Default Value

null

Credential Parameter (Connect-SSH Cmdlet)

The PSCredential object to use for user/password authentication.

Syntax

Connect-SSH -Credential PSCredential

Remarks

Default Value

null

Parameter Position

1

Parameter Alias

auth

EncryptionAlgorithms Parameter (Connect-SSH Cmdlet)

A comma-separated list containing all allowable compression algorithms.

Syntax

Connect-SSH -EncryptionAlgorithms string

Remarks

Default Value

"aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,arcfour256,arcfour128,arcfour,cast128-cbc,aes256-gcm@openssh.com,aes128-gcm@openssh.com"

EOL Parameter (Connect-SSH Cmdlet)

The end of line character to use for parsing the response.

Syntax

Connect-SSH -EOL string

Remarks

Default Value

"'n"

FirewallHost Parameter (Connect-SSH Cmdlet)

Name or IP address of firewall.

Syntax

Connect-SSH -FirewallHost string

Remarks

Default Value

""

FirewallPassword Parameter (Connect-SSH Cmdlet)

A password if authentication is to be used when connecting through the firewall.

Syntax

Connect-SSH -FirewallPassword string

Remarks

Default Value

""

FirewallPort Parameter (Connect-SSH Cmdlet)

The port of the firewall to which to connect.

Syntax

Connect-SSH -FirewallPort int

Remarks

Default Value

0

FirewallType Parameter (Connect-SSH Cmdlet)

Determines the type of firewall to connect through.

Syntax

Connect-SSH -FirewallType string

Remarks

Default Value

0

FirewallUser Parameter (Connect-SSH Cmdlet)

A user name if authentication is to be used connecting through a firewall.

Syntax

Connect-SSH -FirewallUser string

Remarks

Default Value

""

Force Parameter (Connect-SSH Cmdlet)

Forces the component to accept the default behavior instead of querying the user.

Syntax

Connect-SSH -Force SwitchParameter

Remarks

Default Value

false

LocalIP Parameter (Connect-SSH Cmdlet)

The IP address of the local interface to use.

Syntax

Connect-SSH -LocalIP string

Remarks

Default Value

""

Parameter Alias

LocalAddress

LogFile Parameter (Connect-SSH Cmdlet)

The location of a file to which debug information is written.

Syntax

Connect-SSH -LogFile string

Remarks

Default Value

""

Password Parameter (Connect-SSH Cmdlet)

The password to use for authentication.

Syntax

Connect-SSH -Password string

Remarks

Default Value

""

PasswordPrompt Parameter (Connect-SSH Cmdlet)

The shell prompt used for keyboard-interactive authentication.

Syntax

Connect-SSH -PasswordPrompt string

Remarks

Default Value

"password"

Port Parameter (Connect-SSH Cmdlet)

The port to be used.

Syntax

Connect-SSH -Port int

Remarks

Default Value

22

Server Parameter (Connect-SSH Cmdlet)

The address of the Server.

Syntax

Connect-SSH -Server string

Remarks

Default Value

""

Parameter Position

0

This is a required parameter.

ShellPrompt Parameter (Connect-SSH Cmdlet)

Specifies the shell prompt to wait for.

Syntax

Connect-SSH -ShellPrompt string

Remarks

Default Value

""

ShellPromptExpression Parameter (Connect-SSH Cmdlet)

A regular expression to match the shell prompt returned by the server.

Syntax

Connect-SSH -ShellPromptExpression string

Remarks

Default Value

""

SSHAccept Parameter (Connect-SSH Cmdlet)

The hex-encoded fingerprint of the host to trust explicitly.

Syntax

Connect-SSH -SSHAccept string

Remarks

Default Value

""

Parameter Alias

Fingerprint

Stdin Parameter (Connect-SSH Cmdlet)

The text to feed the expression/command on the standard input stream.

Syntax

Connect-SSH -Stdin string

Remarks

Default Value

""

Timeout Parameter (Connect-SSH Cmdlet)

The maximum time allowed for the operation.

Syntax

Connect-SSH -Timeout int

Remarks

Default Value

10

User Parameter (Connect-SSH Cmdlet)

The username to use for authentication.

Syntax

Connect-SSH -User string

Remarks

Default Value

""

SSHConnection Output Object (Connect-SSH Cmdlet)

The connection object.

Syntax

Object SSHConnection {
   string AuthMode;
   string CertPassword;
   string CertStore;
   string CertStoreType;
   string CertSubject;
   string CompressionAlgorithms;
   string[] Config;
   PSCredential Credential;
   string EncryptionAlgorithms;
   string FirewallHost;
   string FirewallPassword;
   int FirewallPort;
   string FirewallType;
   string FirewallUser;
   SwitchParameter Force;
   string LocalIP;
   string LogFile;
   string Password;
   string PasswordPrompt;
   int Port;
   string Server;
   string ShellPrompt;
   string ShellPromptExpression;
   string SSHAccept;
   int Timeout;
   string User;
}

Remarks

This object holds the connection. It may be passed to the Connection parameter of related cmdlets.

Config Settings (Connect-SSH Cmdlet)

InvokeSSH Config Settings

SExec Config Settings

StdInFile:  

SSHClient Config Settings

ChannelDataEOL[ChannelId]:  
ChannelDataEOLFound[ChannelId]:  
ClientSSHVersionString:  
EnablePageantAuth:  
KerberosDelegation:  
KerberosRealm:  
KerberosSPN:  
KeyRenegotiationThreshold:  
LogLevel:  
MaxChannelDataLength[ChannelId]:  
MaxPacketSize:  
MaxWindowSize:  
PasswordPrompt:  
PreferredDHGroupBits:  
RecordLength:  
ServerSSHVersionString:  
SignedSSHCert:  
SSHAcceptAnyServerHostKey:  
SSHAcceptServerCAKey:  
SSHAcceptServerHostKeyFingerPrint:  
SSHFingerprintHashAlgorithm:  
SSHFingerprintMD5:  
SSHFingerprintSHA1:  
SSHFingerprintSHA256:  
SSHKeepAliveCountMax:  
SSHKeepAliveInterval:  
SSHKeyExchangeAlgorithms:  
SSHKeyRenegotiate:  
SSHMacAlgorithms:  
SSHPubKeyAuthSigAlgorithms:  
SSHPublicKeyAlgorithms:  
SSHVersionPattern:  
TryAllAvailableAuthMethods:  
UseStrictKeyExchange:  
WaitForChannelClose:  
WaitForServerDisconnect:  

TCPClient Config Settings

ConnectionTimeout:  
FirewallAutoDetect:  
FirewallHost:  
FirewallPassword:  
FirewallPort:  
FirewallType:  
FirewallUser:  
KeepAliveInterval:  
KeepAliveTime:  
Linger:  
LingerTime:  
LocalHost:  
LocalPort:  
MaxLineLength:  
MaxTransferRate:  
ProxyExceptionsList:  
TCPKeepAlive:  
TcpNoDelay:  
UseIPv6:  

Socket Config Settings

AbsoluteTimeout:  
FirewallData:  
InBufferSize:  
OutBufferSize:  

Base Config Settings

BuildInfo:  
CodePage:  
LicenseInfo:  
MaskSensitive:  
UseInternalSecurityAPI: