Skip to content

Latest commit

 

History

History
311 lines (247 loc) · 6.73 KB

New-SSHSession.md

File metadata and controls

311 lines (247 loc) · 6.73 KB
external help file Module Name online version schema
PoshSSH.dll-Help.xml
Posh-SSH
2.0.0

New-SSHSession

SYNOPSIS

Creates an SSH Session against a SSH Server. By default it will store known host fingerprints in $HOME.poshss\hosts.json.

SYNTAX

NoKey (Default)

New-SSHSession [-ComputerName] <String[]> [-Credential] <PSCredential> [-Port <Int32>] [-ProxyServer <String>]
 [-ProxyPort <Int32>] [-ProxyCredential <PSCredential>] [-ProxyType <String>] [-ConnectionTimeout <Int32>]
 [-KeepAliveInterval <Int32>] [-AcceptKey] [-Force] [-ErrorOnUntrusted] [-KnownHost <IStore>]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

Key

New-SSHSession [-ComputerName] <String[]> [-Credential] <PSCredential> [-Port <Int32>] [-ProxyServer <String>]
 [-ProxyPort <Int32>] [-ProxyCredential <PSCredential>] [-ProxyType <String>] [-KeyFile <String>]
 [-ConnectionTimeout <Int32>] [-KeepAliveInterval <Int32>] [-AcceptKey] [-Force] [-ErrorOnUntrusted]
 [-KnownHost <IStore>] [-ProgressAction <ActionPreference>] [<CommonParameters>]

KeyString

New-SSHSession [-ComputerName] <String[]> [-Credential] <PSCredential> [-Port <Int32>] [-ProxyServer <String>]
 [-ProxyPort <Int32>] [-ProxyCredential <PSCredential>] [-ProxyType <String>] [-KeyString <String[]>]
 [-ConnectionTimeout <Int32>] [-KeepAliveInterval <Int32>] [-AcceptKey] [-Force] [-ErrorOnUntrusted]
 [-KnownHost <IStore>] [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

Creates an SSH Session against a remote server. The command supports creating connection thru a Proxy and allows for authentication to the server using username and password. If a key file is specified the command will use the password in the credentials parameter as the paraphrase of the key.

EXAMPLES

Example 1

PS C:\> New-SSHSession -ComputerName 192.168.1.234 -Credential (Get-Credential) -Verbose

Create a new SSH Session to a server.

PARAMETERS

-ComputerName

FQDN or IP Address of host to establish a SSH Session.

Type: String[]
Parameter Sets: (All)
Aliases: HostName, Computer, IPAddress, Host

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Credential

SSH Credentials to use for connecting to a server. If a key file is used the password field is used for the Key pass phrase.

Type: PSCredential
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Port

SSH TCP Port number to use for the SSH connection.

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: 22
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-ProxyServer

Proxy server name or IP Address to use for connection.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-ProxyPort

Port to connect to on proxy server to route connection.

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: 8080
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-ProxyCredential

PowerShell Credential Object with the credentials for use to connect to proxy server if required.

Type: PSCredential
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-ProxyType

Type of Proxy being used (HTTP, Socks4 or Socks5).

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: HTTP
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-ConnectionTimeout

Connection timeout interval in seconds.

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: 10
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-KeepAliveInterval

Keep Alive interval in seconds for a connection.

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: 10
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-AcceptKey

Automatically accepts a new SSH fingerprint for a host

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Force

Do not perform any host key validation of the host.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-ErrorOnUntrusted

Throw a terminating error if the host key is not a trusted one.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-KeyFile

OpenSSH format SSH private key file.

Type: String
Parameter Sets: Key
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-KeyString

OpenSSH key in a string array to be used for authentication.

Type: String[]
Parameter Sets: KeyString
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-KnownHost

Known Host IStore either from New-SSHMemoryKnownHost, Get-SSHJsonKnownHost or Get-SSHOpenSSHKnownHost.

Type: IStore
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.String[]

System.Management.Automation.PSCredential

System.Int32

System.String

System.Boolean

OUTPUTS

NOTES

RELATED LINKS