Get-SFTP Cmdlet
Parameters Output Objects Config Settings
The Get-SFTP component is used to download files and retrieve directory listings from SFTP servers.
Syntax
Get-SFTP [parameters]
Remarks
This cmdlet implements a standard SFTP client to transfer files from an SSH server's SFTP subsystem.
To use the cmdlet to download a file, you must specify the Server, User, and Password. The file to download from is given by RemoteFile, and the file to download to is specified by LocalFile.
Directory listings may be retrieved by setting List to the remote path of which you wish to receive a directory listing. Results of a directory listing will be returned in one or more EntryInfo objects.
This cmdlet handles listing directories and downloading files. To upload files please see the SEND-SFTP cmdlet.
The cmdlets support pipeline input for some of their parameters. Prebuilding an object and piping it to the cmdlet is very useful, but should be used with caution to prevent security conflicts. Steps have been taken to decrease the risk of a possibly accidental pipe to the cmdlet, for instance, the Credential parameter cannot be piped to the cmdlet and must be specified manually.
# Download a file from an SFTP server
get-sftp -server ftp_server -cred $cred -remotefile text.txt -localfile "C:\text.txt"
# Connect using SSH with public key authentication and download all .txt files
$certPass = Read-Host "Enter Cert Password" -AsSecureString
get-sftp -user test -server SFTPServer -AuthMode PublicKey -CertStoreType PEMKey -CertStore file.pem -CertPassword $certPass -CertSubject * -Path Folder1 -RemoteFile *.txt
Connection Handling
This cmdlet supports persistent connections through the Connection parameter. To establish a new SFTP connection, use the Connect-SFTP cmdlet. To close the connection, use the Disconnect-SFTP cmdlet.
Parameter List
The following is the full list of the parameters of the cmdlet with short descriptions. Click on the links for further details.
Connection | An already established connection. |
LogFile | The location of a file to which debug information is written. |
AfterConnect | A set of FTP commands to be executed immediately after connecting to the Server . |
AfterDownload | A set of FTP commands to be executed immediately after each file downloaded. |
AuthMode | The type of authentication used by the component. |
BeforeDownload | A set of FTP commands to be executed immediately before each file is downloaded. |
CertPassword | The password to the certificate store. |
CertStore | The name of the certificate store for the client certificate. |
CertStoreType | The type of certificate store for the client certificate. |
CertSubject | The subject of the certificate used for client authentication. |
CompressionAlgorithms | A comma-separated list containing all allowable compression algorithms. |
Config | Specifies one or more configuration settings. |
Credential | The PSCredential object to use for user/password authentication. |
EncryptionAlgorithms | A comma-separated list containing all allowable compression algorithms. |
FirewallHost | Name or IP address of firewall. |
FirewallPassword | A password if authentication is to be used when connecting through the firewall. |
FirewallPort | The port of the firewall to which to connect. |
FirewallType | Determines the type of firewall to connect through. |
FirewallUser | A user name if authentication is to be used connecting through a firewall. |
Force | Forces the component to accept the default behavior instead of querying the user. |
List | Get a directory listing for the path and file mask specified. |
LocalFile | The local file to download to. |
LocalIP | The IP address of the local interface to use. |
LogFile | The location of a file to which debug information is written. |
Overwrite | Indicates whether the LocalFile may be overwritten. |
Password | The password to use for authentication. |
PasswordPrompt | The shell prompt used for keyboard-interactive authentication. |
Port | The TCP port in the remote host to which to connect. |
RemoteFile | The name of the remote file to download. |
Server | The address of the Server. |
SSHAccept | The hex-encoded fingerprint of the host to trust explicitly. |
Timeout | The maximum time allowed for the operation. |
User | The 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.
EntryInfo | This object contains details about a file returned from the FTP Server . |
FTPFile | This object is created after a file has finished transferring. |
Config Settings
The following is a list of config settings for the cmdlet with short descriptions. Click on the links for further details.
AllowBackslashInName | Whether backslashes are allowed in folder and file names. |
AsyncTransfer | Controls whether simultatenous requests are made to read or write files. |
AttrAccessTime | Can be queried for the AccessTime file attribute during the DirList event. |
AttrCreationTime | Can be queried for the CreationTime file attribute during the DirList event. |
AttrFileType | Can be queried for the FileType file attribute during the DirList event. |
AttrGroupId | Can be queried for the GroupId file attribute during the DirList event. |
AttrLinkCount | Can be queried for the LinkCount file attribute during the DirList event. |
AttrOwnerId | Can be queried for the OwnerId file attribute during the DirList event. |
AttrPermission | Can be queried for the Permissions file attribute during the DirList event. |
CheckFileHash | Compares a server-computed hash with a hash calculated locally. |
DisableRealPath | Controls whether or not the SSH_FXP_REALPATH request is sent. |
ExcludeFileMask | Specifies a file mask for excluding files in directory listings. |
FileMaskDelimiter | Specifies a delimiter to use for setting multiple file masks in the RemoteFile property. |
FiletimeFormat | Specifies the format to use when returning filetime strings. |
FreeSpace | The free space on the remote server in bytes. |
GetSpaceInfo | Queries the server for drive usage information. |
GetSymlinkAttrs | Whether to get the attributes of the symbolic link, or the resource pointed to by the link. |
IgnoreFileMaskCasing | Controls whether or not the file mask is case sensitive. |
LocalEOL | When TransferMode is set, this specifies the line ending for the local system. |
LogSFTPFileData | Whether SFTP file data is present in Debug logs. |
MaskSensitive | Masks passwords in logs. |
MaxFileData | Specifies the maximum payload size of an SFTP packet. |
MaxOutstandingPackets | Sets the maximum number of simultaneous read or write requests allowed. |
NegotiatedProtocolVersion | The negotiated SFTP version. |
NormalizeRemotePath | Whether to normalize the RemotePath. |
PreserveFileTime | Preserves the file's timestamps during transfer. |
ProtocolVersion | The highest allowable SFTP version to use. |
ReadLink | This settings returns the target of a specified symbolic link. |
RealTimeUpload | Enables real time uploading. |
RealTimeUploadAgeLimit | The age limit in seconds when using RealTimeUpload. |
ServerEOL | When TransferMode is set, this specifies the line ending for the remote system. |
SimultaneousTransferLimit | The maximum number of simultaneous file transfers. |
TotalSpace | The total space on the remote server in bytes. |
TransferMode | The transfer mode (ASCII or Binary). |
TransferredDataLimit | Specifies the maximum number of bytes to download from the remote file. |
UseFxpStat | Whether SSH_FXP_STAT is sent. |
UseServerFileTime | Controls if the file time returned from the server is converted to local time or not. |
UseServerFileTime | Controls if the file time returned from the server is converted to local time or not. |
ClientSSHVersionString | The SSH version string used by the component. |
EnablePageantAuth | Whether to use a key stored in Pageant to perform client authentication. |
KerberosDelegation | If true, asks for credentials with delegation enabled during authentication. |
KerberosRealm | The fully qualified domain name of the Kerberos Realm to use for GSSAPI authentication. |
KerberosSPN | The Kerberos Service Principal Name of the SSH host. |
KeyRenegotiationThreshold | Sets the threshold for the SSH Key Renegotiation. |
LogLevel | Specifies the level of detail that is logged. |
MaxPacketSize | The maximum packet size of the channel, in bytes. |
MaxWindowSize | The maximum window size allowed for the channel, in bytes. |
PasswordPrompt | The text of the password prompt used in keyboard-interactive authentication. |
PreferredDHGroupBits | The size (in bits) of the preferred modulus (p) to request from the server. |
RecordLength | The length of received data records. |
ServerSSHVersionString | The remote host's SSH version string. |
SignedSSHCert | The CA signed client public key used when authenticating. |
SSHAcceptAnyServerHostKey | If set the component will accept any key presented by the server. |
SSHAcceptServerCAKey | The CA public key that signed the server's host key. |
SSHAcceptServerHostKeyFingerPrint | The fingerprint of the server key to accept. |
SSHFingerprintHashAlgorithm | The algorithm used to calculate the fingerprint. |
SSHFingerprintMD5 | The server hostkey's MD5 fingerprint. |
SSHFingerprintSHA1 | The server hostkey's SHA1 fingerprint. |
SSHFingerprintSHA256 | The server hostkey's SHA256 fingerprint. |
SSHKeepAliveCountMax | The maximum number of keep alive packets to send without a response. |
SSHKeepAliveInterval | The interval between keep alive packets. |
SSHKeyExchangeAlgorithms | Specifies the supported key exchange algorithms. |
SSHKeyRenegotiate | Causes the component to renegotiate the SSH keys. |
SSHMacAlgorithms | Specifies the supported Mac algorithms. |
SSHPubKeyAuthSigAlgorithms | Specifies the enabled signature algorithms that may be used when attempting public key authentication. |
SSHPublicKeyAlgorithms | Specifies the supported public key algorithms for the server's public key. |
SSHVersionPattern | The pattern used to match the remote host's version string. |
TryAllAvailableAuthMethods | If set to true, the component will try all available authentication methods. |
WaitForChannelClose | Whether to wait for channels to be closed before disconnected. |
WaitForServerDisconnect | Whether to wait for the server to close the connection. |
ConnectionTimeout | Sets a separate timeout value for establishing a connection. |
FirewallAutoDetect | Tells the component whether or not to automatically detect and use firewall system settings, if available. |
FirewallHost | Name or IP address of firewall (optional). |
FirewallPassword | Password to be used if authentication is to be used when connecting through the firewall. |
FirewallPort | The TCP port for the FirewallHost;. |
FirewallType | Determines the type of firewall to connect through. |
FirewallUser | A user name if authentication is to be used connecting through a firewall. |
KeepAliveInterval | The retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received. |
KeepAliveTime | The inactivity time in milliseconds before a TCP keep-alive packet is sent. |
Linger | When set to True, connections are terminated gracefully. |
LingerTime | Time in seconds to have the connection linger. |
LocalHost | The name of the local host through which connections are initiated or accepted. |
LocalPort | The port in the local host where the component binds. |
MaxLineLength | The maximum amount of data to accumulate when no EOL is found. |
MaxTransferRate | The transfer rate limit in bytes per second. |
ProxyExceptionsList | A semicolon separated list of hosts and IPs to bypass when using a proxy. |
TCPKeepAlive | Determines whether or not the keep alive socket option is enabled. |
TcpNoDelay | Whether or not to delay when sending packets. |
UseIPv6 | Whether to use IPv6. |
AbsoluteTimeout | Determines whether timeouts are inactivity timeouts or absolute timeouts. |
FirewallData | Used to send extra data to the firewall. |
InBufferSize | The size in bytes of the incoming queue of the socket. |
OutBufferSize | The size in bytes of the outgoing queue of the socket. |
BuildInfo | Information about the product's build. |
CodePage | The system code page used for Unicode to Multibyte translations. |
LicenseInfo | Information about the current license. |
MaskSensitive | Whether sensitive data is masked in log messages. |
UseInternalSecurityAPI | Tells the component whether or not to use the system security libraries or an internal implementation. |
LogFile Parameter (Get-SFTP Cmdlet)
The location of a file to which debug information is written.
Syntax
Get-SFTP -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
Connection Parameter (Get-SFTP Cmdlet)
An existing SFTP connection.
Syntax
Get-SFTP -Connection SFTPConnection
Remarks
Represents an existing, persistent SFTP connection to be used. After this cmdlet executes, the connection will remain opened to be used in an another call. New connections can be established using the Connect-SFTP cmdlet and closed using the Disconnect-SFTP cmdlet.Default Value
null
AfterConnect Property (Get-SFTP Cmdlet)
A set of FTP commands to be executed immediately after connecting to the Server .
Syntax
Get-SFTP -AfterConnect string[]
Remarks
AfterConnect is a script that is executed immediately following a successful connection.
The script may contain any number of standard FTP commands.
Each line in the script is treated as a single command. By default, if the cmdlet encounters any errors while executing a command, it will log the error message and will continue to process the script. This behavior can be turned off by inserting "ONERROR FAIL" at any point in the script, which will cause the script to terminate on error but will not interrupt the normal operation of the cmdlet. The default behavior can be restored at any point in the script by inserting the line "ONERROR RESUME".
Valid additional scripting commands are listed below:
cd Path | Change the remote directory to the specified path. |
del Filename | Delete the specified file from the remote server. |
mkdir Directory | Create the specified remote directory on the server. |
rn Filename NewFilename | Rename the remote file specified by Filename to the NewFilename. |
move Filename NewFilename | Move the remote file located at Filename to the NewFilename. |
rm Filename | Remove the specified file from the remote server. |
rmdir Directory | Remove the remote directory from the server. |
Supported Macros
The cmdlet also support the following Macros. These values are not case sensitive and would be supplied to a property in the form %MacroName%.
Temp | This is resolved to the full path to the system's temporary directory. |
SourceFileName | The original file name. This includes the extension and excludes the file path, for example, Sample.xml. This macro is only applicable to AfterDownload, AfterUpload, and AfterDelete. |
DateTime:CustomFormat | This special value allows you to specify your own custom time format. For instance DateTime:yyyy would be resolved to the 4 digit year. |
Date | The date format yyyy-MM-dd. |
DateTime | The date format yyyy-MM-ddThhmmss. |
Time | The date format hhmmss. |
DateTime_BTS2000 | The date format yyyyMMddhhmmssf. |
DateTime.TZ | The date format yyyy-MM-ddThhmmsszzz. |
Time.TZ | The date format hhmmsszzz. |
Default Value
null
AfterDownload Property (Get-SFTP Cmdlet)
A set of FTP commands to be executed immediately after each file downloaded.
Syntax
Get-SFTP -AfterDownload string[]
Remarks
AfterDownload is a script that is executed immediately after downloading a file successfully.
The script may contain any number of standard FTP commands.
Each line in the script is treated as a single command. By default, if the cmdlet encounters any errors while executing a command, it will log the error message and will continue to process the script. This behavior can be turned off by inserting "ONERROR FAIL" at any point in the script, which will cause the script to terminate on error but will not interrupt the normal operation of the cmdlet. The default behavior can be restored at any point in the script by inserting the line "ONERROR RESUME".
Valid additional scripting commands are listed below:
cd Path | Change the remote directory to the specified path. |
del Filename | Delete the specified file from the remote server. |
mkdir Directory | Create the specified remote directory on the server. |
rn Filename NewFilename | Rename the remote file specified by Filename to the NewFilename. |
move Filename NewFilename | Move the remote file located at Filename to the NewFilename. |
rm Filename | Remove the specified file from the remote server. |
rmdir Directory | Remove the remote directory from the server. |
Supported Macros
The cmdlet also support the following Macros. These values are not case sensitive and would be supplied to a property in the form %MacroName%.
Temp | This is resolved to the full path to the system's temporary directory. |
SourceFileName | The original file name. This includes the extension and excludes the file path, for example, Sample.xml. This macro is only applicable to AfterDownload, AfterUpload, and AfterDelete. |
DateTime:CustomFormat | This special value allows you to specify your own custom time format. For instance DateTime:yyyy would be resolved to the 4 digit year. |
Date | The date format yyyy-MM-dd. |
DateTime | The date format yyyy-MM-ddThhmmss. |
Time | The date format hhmmss. |
DateTime_BTS2000 | The date format yyyyMMddhhmmssf. |
DateTime.TZ | The date format yyyy-MM-ddThhmmsszzz. |
Time.TZ | The date format hhmmsszzz. |
Default Value
null
AuthMode Property (Get-SFTP Cmdlet)
The type of authentication used by the component.
Syntax
Get-SFTP -AuthMode string
Remarks
Normally, the cmdlet will attempt to log in to the SSH server and authenticate via username and password. This behavior can be changed to use client key (RSA) authentication by setting this parameter to 'PublicKey'.
Password (default) | Password authentication used with the SSH server. |
PublicKey | When Public Key authentication is used, the cmdlet will search the certificate store specified in CertStore for a private key associated with CertSubject when logging onto the SSH server. This private key is used to verify the client's identity during the user authentication phase of the SSH logon process. |
KeyboardInteractive | When KeyboardInteractive authentication is used, the cmdlet will wait for the server to prompt for the password using PasswordPrompt and supply the value of the Password property. This should not be confused with Password authentication. |
GSSAPIWithMic | This allows the cmdlet to attempt Kerberos authentication using the GSSAPI-WITH-MIC scheme. The client will try Kerberos authentication using the value of User (single sign-on), or if Password is specified as well, it will try Kerberos authentication with alternate credentials. |
MultiFactor | This allows the cmdlet to attempt a multi-step authentication process. The cmdlet will send authentication data to the server based on the list of methods allowed for the current user and the authentication property values supplied. |
Default Value
2
BeforeDownload Property (Get-SFTP Cmdlet)
A set of FTP commands to be executed immediately before each file is downloaded.
Syntax
Get-SFTP -BeforeDownload string[]
Remarks
BeforeDownload is a script that is executed immediately before downloading a file.
The script may contain any number of standard FTP commands.
Each line in the script is treated as a single command. By default, if the cmdlet encounters any errors while executing a command, it will log the error message and will continue to process the script. This behavior can be turned off by inserting "ONERROR FAIL" at any point in the script, which will cause the script to terminate on error but will not interrupt the normal operation of the cmdlet. The default behavior can be restored at any point in the script by inserting the line "ONERROR RESUME".
Valid additional scripting commands are listed below:
cd Path | Change the remote directory to the specified path. |
del Filename | Delete the specified file from the remote server. |
mkdir Directory | Create the specified remote directory on the server. |
rn Filename NewFilename | Rename the remote file specified by Filename to the NewFilename. |
move Filename NewFilename | Move the remote file located at Filename to the NewFilename. |
rm Filename | Remove the specified file from the remote server. |
rmdir Directory | Remove the remote directory from the server. |
Supported Macros
The cmdlet also support the following Macros. These values are not case sensitive and would be supplied to a property in the form %MacroName%.
Temp | This is resolved to the full path to the system's temporary directory. |
SourceFileName | The original file name. This includes the extension and excludes the file path, for example, Sample.xml. This macro is only applicable to AfterDownload, AfterUpload, and AfterDelete. |
DateTime:CustomFormat | This special value allows you to specify your own custom time format. For instance DateTime:yyyy would be resolved to the 4 digit year. |
Date | The date format yyyy-MM-dd. |
DateTime | The date format yyyy-MM-ddThhmmss. |
Time | The date format hhmmss. |
DateTime_BTS2000 | The date format yyyyMMddhhmmssf. |
DateTime.TZ | The date format yyyy-MM-ddThhmmsszzz. |
Time.TZ | The date format hhmmsszzz. |
Default Value
null
CertPassword Property (Get-SFTP Cmdlet)
The password to the certificate store.
Syntax
Get-SFTP -CertPassword string
Remarks
Specifies a password (if required) to access the specified certificate store.
Default Value
""
Parameter Alias
CertificatePassword
CertStore Property (Get-SFTP Cmdlet)
The name of the certificate store for the client certificate.
Syntax
Get-SFTP -CertStore string
Remarks
The CertStoreType parameter specifies the type of the certificate store specified by CertStore. If the store is password protected, specify the password in CertPassword.
CertStore is used in conjunction with the CertSubject parameter in order to specify client certificates. If CertStore has a value, and CertSubject has been set, a search for a certificate is initiated during logon. Please refer to the CertSubject parameter for details.
Designations of certificate stores are platform-dependent.
The following are designations of the most common User and Machine certificate stores in Windows:
MY | A certificate store holding personal certificates with their associated private keys. |
CA | Certifying authority certificates. |
ROOT | Root certificates. |
SPC | Software publisher certificates. |
When the certificate store type is PFXFile, this parameter must be set to the name of the file.
Default Value
"MY"
Parameter Alias
CertificateStore
CertStoreType Property (Get-SFTP Cmdlet)
The type of certificate store for the client certificate.
Syntax
Get-SFTP -CertStoreType string
Remarks
This parameter can take one of the following values:
User (default) | This specifies that the certificate store is owned by the current user (these are the user's registry certificate stores such as MY, CA, etc.). |
Machine | The certificate store is a machine store. |
PFXFile | The certificate store is the name of a PFX (PKCS12) file containing certificates. |
PFXBlob | The certificate store is a string (base64 encoded) representing a certificate store in PFX (PKCS12) format. You should use this option if storing a pfx file's content in a shell variable. |
PEMKeyFile | The certificate store is the name of a file that contains a PEM encoded certificate and private key. |
PEMKeyBlob | The certificate store is a string that contains a PEM encoded certificate and private key. |
P7BFile | The certificate store is the name of a file that contains P7B encoded certificates. |
SSHPublicKeyFile | The certificate store is the name of a file that contains an SSH-style public key. |
PPKFile | The certificate store is the name of a file that contains a PPK (PuTTY Private Key). |
PPKBlob | The certificate store is a string (binary) that contains a PPK (PuTTY Private Key). |
Default Value
0
CertSubject Property (Get-SFTP Cmdlet)
The subject of the certificate used for client authentication.
Syntax
Get-SFTP -CertSubject string
Remarks
During the user authentication phase of the logon process, the cmdlet will search the store specified in CertStore for a certificate that matches this parameter. If the store contains a private key for that certificate, it is used to verify the user's identity with the secure server.
When this parameter is set, a search is performed in the current certificate store certificate with matching subject.
If an exact match is not found, the store is searched for subjects containing the value of the parameter.
When setting the parameter to a partial subject, CN= should be omitted. For example, the following code would find the certificate with subject CN=Test Certificate, OU=People, C=US
Example (Searching with partial subject)
-certsubject "Test"
If a match is not found, the parameter is set to an empty string, and no certificate is selected.
The special value "*" picks a random certificate in the certificate store.
Default Value
"*"
CompressionAlgorithms Property (Get-SFTP Cmdlet)
A comma-separated list containing all allowable compression algorithms.
Syntax
Get-SFTP -CompressionAlgorithms string
Remarks
During the SSH handshake, this list will be used to negotiate the compression algorithm to be used between the client and server. This list is used for both directions: client to server and server to client. When negotiating algorithms, each side sends a list of all algorithms it supports or allows. The algorithm chosen for each direction is the first algorithm to appear in the sender's list that the receiver supports, so it is important to list multiple algorithms in preferential order. If no algorithm can be agreed upon, the cmdlet will raise an error and the connection will be aborted.
At least one support algorithm must appear in this list. The following compression algorithms are supported by the cmdlet:
- zlib
- zlib@openssh.com
- none
Default Value
"none"
Config Property (Get-SFTP Cmdlet)
Specifies one or more configuration settings.
Syntax
Get-SFTP -Config string[]
Remarks
The Config parameter takes one or more name-value pairs that represent the name of the configuration setting and value, i.e.: -config "Name=Value"
Default Value
null
Credential Property (Get-SFTP Cmdlet)
The PSCredential object to use for user/password authentication.
Syntax
Get-SFTP -Credential PSCredential
Remarks
Every cmdlet that supports user authentication will expose a Credential parameter. A PSCredential object should be specified for this parameter. Alternatively, the User and Password parameters can be set to represent the credential information.
If the cmdlet supports client key authentication it uses the password field of this object for the certificate's password. This setting is enabled by using public key authentication. Note: Due to security reasons, it is recommended that you use the Credential parameter rather than User and Password to specify the authentication information.
Default Value
null
Parameter Position
1
Parameter Alias
auth
EncryptionAlgorithms Property (Get-SFTP Cmdlet)
A comma-separated list containing all allowable compression algorithms.
Syntax
Get-SFTP -EncryptionAlgorithms string
Remarks
During the SSH handshake, this list will be used to negotiate the encryption algorithm to be used between the client and server. This list is used for both directions: client to server and server to client. When negotiating algorithms, each side sends a list of all algorithms it supports or allows. The algorithm chosen for each direction is the first algorithm to appear in the sender's list that the receiver supports, so it is important to list multiple algorithms in preferential order. If no algorithm can be agreed upon, the cmdlet will raise an error and the connection will be aborted.
At least one support algorithm must appear in this list. The following encryption algorithms are supported by the cmdlet:
aes256-ctr | 256-bit AES encryption in CTR mode |
aes256-cbc | 256-bit AES encryption in CBC mode |
aes192-ctr | 192-bit AES encryption in CTR mode |
aes192-cbc | 192-bit AES encryption in CBC mode |
aes128-ctr | 128-bit AES encryption in CTR mode |
aes128-cbc | 128-bit AES encryption in CBC mode |
3des-ctr | 192-bit (3-key) triple DES encryption in CTR mode |
3des-cbc | 192-bit (3-key) triple DES encryption in CBC mode |
cast128-cbc | CAST-128 encryption |
blowfish-cbc | Blowfish encryption |
arcfour | ARC4 encryption |
arcfour128 | 128-bit ARC4 encryption |
arcfour256 | 256-bit ARC4 encryption |
aes256-gcm@openssh.com | 256-bit AES encryption in GCM mode. |
aes128-gcm@openssh.com | 128-bit AES encryption in GCM mode. |
By default, "aes256-cbc", the only encryption algorithm recommended by the SSH specification, and "3des-cbc", the only algorithm required, are enabled. It is not recommended to enable "none", as this defeats the purpose of an SSH connection.
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"
FirewallHost Property (Get-SFTP Cmdlet)
Name or IP address of firewall.
Syntax
Get-SFTP -FirewallHost string
Remarks
If a FirewallHost is given, requested connections will be authenticated through the specified firewall when connecting.
If the FirewallHost parameter is set to a Domain Name, a DNS request is initiated. Upon successful termination of the request, the FirewallHost parameter is set to the corresponding address. If the search is not successful, an error is returned.
Default Value
""
FirewallPassword Property (Get-SFTP Cmdlet)
A password if authentication is to be used when connecting through the firewall.
Syntax
Get-SFTP -FirewallPassword string
Remarks
If FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to authenticate against the firewall.
Default Value
""
FirewallPort Property (Get-SFTP Cmdlet)
The port of the firewall to which to connect.
Syntax
Get-SFTP -FirewallPort int
Remarks
The TCP port for the FirewallHost. See the description of the FirewallHost parameter for details.
Note that the FirewallPort is set automatically when FirewallType is set to a valid value. See the description of the FirewallType parameter for details. Setting this parameter will overwrite the default settings for the firewall port as specified by FirewallType.
Default Value
0
FirewallType Property (Get-SFTP Cmdlet)
Determines the type of firewall to connect through.
Syntax
Get-SFTP -FirewallType string
Remarks
The applicable values are the following:
None | No firewall (default setting). |
Tunnel | Connect through a tunneling proxy. FirewallPort is set to 80. |
SOCKS4 | Connect through a SOCKS4 Proxy. FirewallPort is set to 1080. |
SOCKS5 | Connect through a SOCKS5 Proxy. FirewallPort is set to 1080. |
Default Value
0
FirewallUser Property (Get-SFTP Cmdlet)
A user name if authentication is to be used connecting through a firewall.
Syntax
Get-SFTP -FirewallUser string
Remarks
If FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to authenticate against the firewall.
Default Value
""
Force Property (Get-SFTP Cmdlet)
Forces the component to accept the default behavior instead of querying the user.
Syntax
Get-SFTP -Force SwitchParameter
Remarks
The Force parameter is especially useful in a script environment where user interaction is not an option. Certain cmdlets that are SSH and SSL based will query the user if the security credentials of the certificate presented by the server are not met. Setting this parameter will force the cmdlet to accept the certificate of the server unconditionally.
Default Value
false
List Property (Get-SFTP Cmdlet)
Get a directory listing for the path and file mask specified.
Syntax
Get-SFTP -List string
Remarks
Set List to a path and file mask to cause the contents of that directory matching that mask to be listed. The path can be a relative directory or an absolute path, but directories must be separated using the "/" separator.
Default Value
""
Parameter Alias
Path
LocalFile Property (Get-SFTP Cmdlet)
The local file to download to.
Syntax
Get-SFTP -LocalFile string
Remarks
LocalFile contains the full path and filename on your machine that the RemoteFile will be saved to.
Default Value
""
LocalIP Property (Get-SFTP Cmdlet)
The IP address of the local interface to use.
Syntax
Get-SFTP -LocalIP string
Remarks
This parameter is useful when the cmdlet is running on a machine that has more than one network interface (each with its own IP address and network access privileges).
Default Value
""
Parameter Alias
LocalAddress
LogFile Property (Get-SFTP Cmdlet)
The location of a file to which debug information is written.
Syntax
Get-SFTP -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
""
Overwrite Property (Get-SFTP Cmdlet)
Indicates whether the LocalFile may be overwritten.
Syntax
Get-SFTP -Overwrite SwitchParameter
Remarks
If the LocalFile exists on the machine and Overwrite is false, the download will fail.
Default Value
false
Password Property (Get-SFTP Cmdlet)
The password to use for authentication.
Syntax
Get-SFTP -Password string
Remarks
Every time User, or Password are set, the cmdlet will authenticate with the server. It is recommended that the Credential parameter is set instead of User/Password because of security reasons. If both Credential and this parameter is set, the Credential value is used.
Default Value
""
PasswordPrompt Property (Get-SFTP Cmdlet)
The shell prompt used for keyboard-interactive authentication.
Syntax
Get-SFTP -PasswordPrompt string
Remarks
If AuthMode is set to Keyboard-Interactive, the shell's password prompt must be specified in PasswordPrompt. At connection, the cmdlet will wait for the PasswordPrompt and provide the Password when it is received.
Default Value
"password"
Port Property (Get-SFTP Cmdlet)
The TCP port in the remote host to which to connect.
Syntax
Get-SFTP -Port int
Remarks
Port specifies a service port on the remote host to which to connect.
A valid port number (a value between 1 and 65535) is required for the connection to take place.
Default Value
22
RemoteFile Property (Get-SFTP Cmdlet)
The name of the remote file to download.
Syntax
Get-SFTP -RemoteFile string
Remarks
The RemoteFile is either an absolute file path, or a relative path based on the home path set by the server. This value must include a filemask or filename. For instance:
get-ftp -server TestServer -user test -password test -remotefile MyFolder/*.txt
The above code will download all .txt files in the MyFolder folder.
Default Value
""
Parameter Position
1
Parameter Alias
Download
Server Property (Get-SFTP Cmdlet)
The address of the Server.
Syntax
Get-SFTP -Server string
Remarks
The cmdlet requires a server address to be provided. Either an IP address or the server host name can be provided.
Default Value
""
Parameter Position
0
This is a required parameter.
SSHAccept Property (Get-SFTP Cmdlet)
The hex-encoded fingerprint of the host to trust explicitly.
Syntax
Get-SFTP -SSHAccept string
Remarks
The fingerprint will be an MD5 hash of the host key in hex-encoded form, i.e. "0a:1b:2c:3d". Setting this will instruct the cmdlet to trust the fingerprint provided without prompting for verification.
After each connection, regardless of whether or not the key was trusted, the cmdlet will store the server's host key in the $SSHServerHostKey session variable. This variable can be inspected to view details of the server's key.
If the Force parameter is set, the cmdlet will accept the server's key unconditionally.
In cases where the host key presented by the server is not trusted, a prompt will be shown to the user. This prompt will allow the user to decide whether or not they would like to accept the host key presented by the server.
There may be cases where you do not want a prompt to be displayed or would like to handle the response supplied directly within your script. This can be done by setting the $SSHAcceptPreference variable prior to running the cmdlet. The available values for this variable are:
None (default) | Maintains the default behavior. If the host key is not trusted by default, the user will be prompted. |
Accept | Accepts the host key without prompting the user, even if it is not trusted by default. |
Reject | Rejects the host key without prompting the user only if it is not trusted by default. Thus if the host key is found to be trusted or the Force parameter is set, the connection will still be accepted. |
Default Value
""
Parameter Alias
Fingerprint
Timeout Property (Get-SFTP Cmdlet)
The maximum time allowed for the operation.
Syntax
Get-SFTP -Timeout int
Remarks
After the specified interval in seconds, the cmdlet will throw a Timeout error if the operation is not completed.
Default Value
10
User Property (Get-SFTP Cmdlet)
The username to use for authentication.
Syntax
Get-SFTP -User string
Remarks
Every time User and Password are set, the cmdlet will authenticate with the server. It is recommended that the Credential parameter is set instead of User/Password because of security reasons. If both Credential and this parameter is set, the Credential value is used.
Default Value
""
EntryInfo Output Object (Get-SFTP Cmdlet)
This object contains details about a file returned from the FTP Server .
Syntax
Object EntryInfo {string DirEntry;
string FileName;
long FileSize;
string FileTime;
bool IsDir;
}
Remarks
After using List to retrieve a directory list from the FTP Server, information about each entry returned in that listing will be stored in one or more EntryInfo objects.
In Unix systems the date is given in two types of formats: If the date is in the last 12 months the exact time is specified and the year is omitted. Otherwise only the date and the year but not hours or minutes are given.
FTPFile Output Object (Get-SFTP Cmdlet)
This object is created after a file has finished transferring.
Syntax
Object FTPFile {string Name;
int Time;
long Size;
int TransferRate;
}
Remarks
Once a file has finished being transferred, the FTPFile object is created with the Name of the file and the Time it took to transfer. TransferRate indicates the transfer rate in KBytes/s, this is calculated by dividing Size by the Time that it took.
Config Settings (Get-SFTP Cmdlet)
The cmdlet accepts one or more of the following configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the cmdlet, access to these internal properties is provided through the Config method.SFTP Config Settings
AllowBackslashInName:
Whether backslashes are allowed in folder and file names.By default the backslash character is treated as a path separator and is not allowed in file and folder names. When this configuration setting is set to True, backslashes "\" are allowed in file and folder names, and are not supported as path separators.
The default value is False. |
|
AsyncTransfer: Controls whether simultatenous requests are made to read or write files.When set to true, the cmdlet will make several requests to read or write data before waiting for a response from the server. The maximum number of these requests that can be made is controlled by MaxOutstandingPackets. The default is true. | |
AttrAccessTime: Can be queried for the AccessTime file attribute during the DirList event.During DirList, this configuration setting can be queried to retrieve the value of the AccessTime file attribute if it is present in the response from the server. | |
AttrCreationTime: Can be queried for the CreationTime file attribute during the DirList event.During DirList, this configuration setting can be queried to retrieve the value of the CreationTime file attribute if it is present in the response from the server. | |
AttrFileType: Can be queried for the FileType file attribute during the DirList event.During DirList, this configuration setting can be queried to retrieve the value of the FileType file attribute if it is present in the response from the server. | |
AttrGroupId: Can be queried for the GroupId file attribute during the DirList event.During DirList, this configuration setting can be queried to retrieve the value of the GroupId file attribute if it is present in the response from the server. | |
AttrLinkCount: Can be queried for the LinkCount file attribute during the DirList event.During DirList, this configuration setting can be queried to retrieve the value of the LinkCount file attribute if it is present in the response from the server. | |
AttrOwnerId: Can be queried for the OwnerId file attribute during the DirList event.During DirList, this configuration setting can be queried to retrieve the value of the OwnerId file attribute if it is present in the response from the server. | |
AttrPermission: Can be queried for the Permissions file attribute during the DirList event.During DirList, this configuration setting can be queried to retrieve the value of the Permissions file attribute if it is present in the response from the server. | |
CheckFileHash:
Compares a server-computed hash with a hash calculated locally.This setting may be queried to compare a hash of the file specified by RemoteFile with the hash calculated by the server.
When queried the cmdlet will ask the server to calculate a hash of the file. It will then compute a hash locally and
compare the values to confirm the content that exists in the file specified by RemoteFile is the same as the file specified by LocalFile.
The server must support the check-file extension. The cmdlet supports the following hash algorithms (in order of preference): sha256,sha224,sha384,sha512,sha1,md5. The server may choose to use any value from this list. No action is needed to configure the algorithm, the cmdlet will automatically use the same algorithm that the server users. If the extension is unsupported or a mismatch in hashes is detected the cmdlet throws an exception. If the hashes match the value "True" is returned.
|
|
DisableRealPath: Controls whether or not the SSH_FXP_REALPATH request is sent.This configuration setting can be used to skip sending the SSH_FXP_REALPATH request, which asks the server to canonicalize the value in RemotePath to an absolute path. The default value is false, which will cause the component to send the request normally. If set to true, component will not send the SSH_FXP_REALPATH packet and will use the value in RemotePath directly. | |
ExcludeFileMask: Specifies a file mask for excluding files in directory listings.This configuration setting specifies one or more file masks to be excluded during a directory listing. When using multiple masks, any files that match one or more of the masks will not be listed. For example, setting ExcludeFileMask to "*.txt", RemoteFile to "", and calling ListDirectory will list all files except those ending in .txt. | |
FileMaskDelimiter: Specifies a delimiter to use for setting multiple file masks in the RemoteFile property.If specified, the RemoteFile property will be split into separate masks based on the chosen delimiter. The default is "", which will cause the RemoteFile property to be treated as a single value. When using multiple masks, any files that match one or more of the masks will be listed. For example, setting FileMaskDelimiter to "," and setting RemoteFile to "*.txt, *.csv" will list all files ending in .txt or .csv. | |
FiletimeFormat: Specifies the format to use when returning filetime strings.If specified, the cmdlet will use this value to format the filetime string returned through the DirList event. If no format is specified, the cmdlet will format the date dependent on the year. If the filetime is in the same year, it will be formatted as "MMM dd HH:mm", otherwise it will be formatted as "MMM dd yyyy". | |
FreeSpace: The free space on the remote server in bytes.This property is populated after calling the GetSpaceInfo configuration setting. This holds the total free space available on the drive on the remote server in bytes. | |
GetSpaceInfo:
Queries the server for drive usage information.This setting queries the server for the total space and free space available on the remote drive. When querying
this setting the cmdlet will immediately request the information from the server. After calling this setting
the TotalSpace and FreeSpace configuration settings will be populated.
Note: The server must understand either the "statvfs@openssh.com" or "space-available" extension in order for this operation to succeed. |
|
GetSymlinkAttrs:
Whether to get the attributes of the symbolic link, or the resource pointed to by the link.When FileAttributes is queried the cmdlet will retrieve information about the RemoteFile. This setting controls the behavior when RemoteFile refers to a symbolic link on the server. By default the information returned by FileAttributes is that of the actual file pointed to by the symbolic link, not the symbolic link itself.
If it is desired to retrieve the attributes of the symbolic link itself, set GetSymlinkAttrs to True before querying FileAttributes. |
|
IgnoreFileMaskCasing: Controls whether or not the file mask is case sensitive.This applies to the file mask value specified by the RemoteFile property. The default value is true. If set to false, the file mask will be case sensitive. | |
LocalEOL:
When TransferMode is set, this specifies the line ending for the local system.This setting is only applicable when TransferMode is set to 1 (ASCII).
The default value is a CrLf character sequence.
When uploading or downloading this value will be compared to ServerEOL. If ServerEOL and LocalEOL are different, the line endings in the file being transferred will be converted to the line endings used by the destination. Line endings will be converted to the value in LocalEOL when downloading. Line endings will be converted to the value in ServerEOL when uploading. If ServerEOL and LocalEOL are the same, no conversion takes place. The value supplied to this setting must be quoted. For instance:
Conversion will only happen when TransferMode is set to 1 (ASCII) and ServerEOL and LocalEOL are different. |
|
LogSFTPFileData: Whether SFTP file data is present in Debug logs.This setting controls whether file data is logged when LogLevel is set to 3 (Debug). When False (default) the file data being transferred is not included. Set this value to True to include all traffic include file data. Note: setting this value to True will increase the amount of data that is logged. | |
MaskSensitive: Masks passwords in logs.The default value is False. When set to True, the cmdlet will mask passwords that otherwise would appear in its logs. | |
MaxFileData:
Specifies the maximum payload size of an SFTP packet.While the SSH specification requires servers and clients to support SSH packets of at least 32000 bytes, some server implementations limit packet size to smaller values. MaxFileData provides a means by which the user can specify the maximum amount of data that can be put into an SFTP packet so that the cmdlet can communicate effectively with these servers. If you are having difficulty when uploading to a server, try setting MaxFileData size to a value smaller than 32000.
Most servers that use smaller values will use a maximum SSH packet size of 16KB (16384). In order to most efficiently communicate with such servers, MaxFileData size should be set to 14745. Note: Values larger than 64K (65536) may not be respected by some servers (such as OpenSSH) and will result in unexpected behavior. If specifying a value, it is recommended to set a value less than or equal to 65536. The default value is 32768. |
|
MaxOutstandingPackets: Sets the maximum number of simultaneous read or write requests allowed.This sets the number of simultaneous read or write requests allowed. This setting only applies when AsyncTransfer is true. The default is 8. | |
NegotiatedProtocolVersion: The negotiated SFTP version.This returns the negotiated version of SFTP. Query this to ensure that the correct version was negotiated. This configuration setting is read-only. | |
NormalizeRemotePath: Whether to normalize the RemotePath.When set to true, the component will normalize the value in RemotePath by appending a forward slash (/) if one is not already present. "." and ".." are special cases and will not be affected. The default is true. | |
PreserveFileTime: Preserves the file's timestamps during transfer.If set to True, the cmdlet will preserve the file's timestamps during transfer. This is applicable to both uploads and downloads. The default value is False. | |
ProtocolVersion: The highest allowable SFTP version to use.This governs the highest allowable SFTP version to use when negotiating the version with the server. The default value is 3 as this is the most common version. The cmdlet supports values from 3 to 6. It is recommended to use the default value of 3 unless there is a specific reason a higher version is needed. | |
ReadLink:
This settings returns the target of a specified symbolic link.This setting returns the target of the specified symbolic link. To use the setting, pass the remote path and file name of the symbolic link. For instance:
string resolvedPath = component.Config("ReadLink=/home/test/mysymlink.txt");
|
|
RealTimeUpload: Enables real time uploading.When this value is set to "True" the cmdlet will upload the data in the file specified by LocalFile and continue monitoring LocalFile for additional data to upload until no new data is found for RealTimeUploadAgeLimit seconds. This allows you to start uploading a file immediately after the file is created and continue uploading as data is written to the file. The default value is "False". | |
RealTimeUploadAgeLimit: The age limit in seconds when using RealTimeUpload.This value is only applicable when RealTimeUpload is set to "True". This specifies the number of seconds for which the cmdlet will monitor LocalFile for new data to upload. If this limit is reached and no new data is found in LocalFile the upload will complete. The default value is "1". | |
ServerEOL:
When TransferMode is set, this specifies the line ending for the remote system.This setting is only applicable when TransferMode is set to 1 (ASCII).
The default value is a CrLf character sequence.
When uploading or downloading this value will be compared to LocalEOL. If ServerEOL and LocalEOL are different, the line endings in the file being transferred will be converted to the line endings used by the destination. Line endings will be converted to the value in LocalEOL when downloading. Line endings will be converted to the value in ServerEOL when uploading. If ServerEOL and LocalEOL are the same, no conversion takes place. The value supplied to this setting must be quoted. For instance:
Conversion will only happen when TransferMode is set to 1 (ASCII) and ServerEOL and LocalEOL are different. |
|
SimultaneousTransferLimit: The maximum number of simultaneous file transfers.This setting specifies the maximum number of simultaneous file transfers. This is used when processing files added to the transfer queue by QueueFile. The default value is "5". | |
TotalSpace: The total space on the remote server in bytes.This property is populated after calling the GetSpaceInfo configuration setting. This holds the total space on the drive on the remote server in bytes. | |
TransferMode:
The transfer mode (ASCII or Binary).The value 0 represents Binary and the value 1 represents ASCII. If the value is 0 (default), the initial server mode will be used.
When this value is set to 1 (ASCII) the cmdlet will use the values specified in LocalEOL and ServerEOL to convert line endings as appropriate. Note: When this value is set to 1 (ASCII) and ProtocolVersion is set to 4 or higher the cmdlet will automatically determine the value for ServerEOL if the server supports the "newline" protocol extension. |
|
TransferredDataLimit:
Specifies the maximum number of bytes to download from the remote file.This setting specifies the maximum number of bytes which should be downloaded from the current RemoteFile when
Download is called. The cmdlet will stop downloading data if it reaches the specified limit, or if there is
no more data to download.
This setting can be used in conjunction with the StartByte property in order to download a specific range of data from the current RemoteFile. |
|
UseFxpStat:
Whether SSH_FXP_STAT is sent.For certain operations the cmdlet will send SSH_FXP_STAT to get a file's attributes. Some servers do not support this packet and will return an error.
Set this to false to not send the packet. This will cause PreserveFileTime to not work and prevent PercentDone in Transfer from being calculated. The default is true. |
|
UseServerFileTime: Controls if the file time returned from the server is converted to local time or not.If set to false the component will return the filetime as the system's local time, otherwise it will return with the time as it is reported by the server. Controls if the file time returned from the server is converted to local time or not.If set to false the component will return the filetime as the system's local time, otherwise it will return with the time as it is reported by the server. The default is false. | |
UseServerFileTime: Controls if the file time returned from the server is converted to local time or not.If set to false the component will return the filetime as the system's local time, otherwise it will return with the time as it is reported by the server. Controls if the file time returned from the server is converted to local time or not.If set to false the component will return the filetime as the system's local time, otherwise it will return with the time as it is reported by the server. The default is false. |
SSHClient Config Settings
ClientSSHVersionString: The SSH version string used by the cmdlet.This configuration setting specifies the SSH version string used by the cmdlet. The default value is "SSH-2.0-IPWorks SSH Client 2022". | |||||||||||||||||||
EnablePageantAuth:
Whether to use a key stored in Pageant to perform client authentication.This setting controls whether Pageant authentication is disabled, enabled, or required. When enabled or required, the cmdlet attempts to communicate with PuTTY's ssh-agent, called "Pageant", over shared memory to perform public key authentication. Possible values and the corresponding behavior is described below:
Example enabling Pageant:
Note: This functionality is only available on Windows. |
|||||||||||||||||||
KerberosDelegation: If true, asks for credentials with delegation enabled during authentication.The default value is "True". If set to "False", the client will not ask for credentials delegation support during authentication. Note that even if the client asks for delegation, the server/KDC might not grant it and authentication will still succeed. | |||||||||||||||||||
KerberosRealm: The fully qualified domain name of the Kerberos Realm to use for GSSAPI authentication.This property may be set to the fully qualified (DNS) name of the kerberos realm (or Windows Active Directory domain name) to use during GSSAPI authentication. This can be used to force authentication with a given realm if the client and server machines are not part of the same domain. | |||||||||||||||||||
KerberosSPN: The Kerberos Service Principal Name of the SSH host.This property can be set to specify the Service Principal Name (SPN) associated with the SSH service on the remote host. This will usually be in the form "host/fqdn.of.sshhost[@REALM]". If not specified, the cmdlet will assume the SPN is based on the value of the SSHHost property and the kerberos realm used for authentication. | |||||||||||||||||||
KeyRenegotiationThreshold:
Sets the threshold for the SSH Key Renegotiation.This property allows you to specify the threshold, in the number of bytes, for the SSH Key Renegotiation.
The default value for this property is set to 1 GB.
Example (for setting the threshold to 500 MB):
|
|||||||||||||||||||
LogLevel:
Specifies the level of detail that is logged.This setting controls the level of detail that is logged through the Log event. Possible values are:
|
|||||||||||||||||||
MaxPacketSize: The maximum packet size of the channel, in bytes.This setting specifies the maximum size of an individual data packet, in bytes, that can be sent to the sender. | |||||||||||||||||||
MaxWindowSize: The maximum window size allowed for the channel, in bytes.This setting specifies how many bytes of channel data can be sent to the sender of this message without adjusting the window. Note that this value may be changed during the connection, but the window size can only be increased, not decreased. | |||||||||||||||||||
PasswordPrompt:
The text of the password prompt used in keyboard-interactive authentication.This setting optionally specifies a pattern to be matched to the prompt received from the server
during keyboard-interactive authentication. If a matching prompt is detected the cmdlet
automatically responds to the prompt with the password specified by SSHPassword.
This provides an easy way to automatically reply to prompts with the password if one is presented by the server. The password will be auto-filled in the Response parameter of the SSHKeyboardInteractive event in the case of a match. The following special characters are supported for pattern matching:
If these characters need to be used as a literal in a pattern, then they must be escaped by surrounding them with brackets []. Note: "]" and "-" do not need to be escaped. See below for the escape sequences:
For example, to match the value [Something].txt, specify the pattern [[]Something].txt. |
|||||||||||||||||||
PreferredDHGroupBits: The size (in bits) of the preferred modulus (p) to request from the server.This may be when using the diffie-hellman-group-exchange-sha1 or diffie-hellman-group-exchange-sha256 key exchange algorithms to control the preferred size, in bits, of the modulus (p) prime number to request from the server. Acceptable values are between 1024 and 8192. | |||||||||||||||||||
RecordLength:
The length of received data records.If set to a positive value, this setting defines the length of data records to be received. The cmdlet will accumulate data
until RecordLength is reached and only then fire the DataIn event with data of length RecordLength.
This allows data to be received as records of known length. This value can be changed at any time, including within the DataIn event.
The default value is 0, meaning this setting is not used. |
|||||||||||||||||||
ServerSSHVersionString: The remote host's SSH version string.This will return the remote host's SSH version string, which can help when identifying problematic servers. This configuration setting is read-only. | |||||||||||||||||||
SignedSSHCert:
The CA signed client public key used when authenticating.When authenticating via public key authentication this setting may be set to the CA signed client's public key.
This is useful when the server has been configured to trust client keys signed by a particular CA. For instance:
component.Config("SignedSSHCert=ssh-rsa-cert-v01@openssh.com AAAAB3NzaC1yc2EAAAADAQABAAAB...");
The algorithm such as ssh-rsa-cert-v01@openssh.com in the above string is used as part of the authentication process. To use a different algorithm simply change this value. For instance all of the following are acceptable with the same signed public key:
|
|||||||||||||||||||
SSHAcceptAnyServerHostKey: If set the cmdlet will accept any key presented by the server.The default value is "False". Set this to "True" to accept any key presented by the server. | |||||||||||||||||||
SSHAcceptServerCAKey:
The CA public key that signed the server's host key.If the server's host key was signed by a CA, this setting may be used to specify the CA's public key. If specified
the cmdlet will trust any server's host key that was signed by the CA. For instance:
component.Config("SSHAcceptServerCAKey=ssh-rsa AAAAB3NzaC1yc2EAAAADAQAB...");
|
|||||||||||||||||||
SSHAcceptServerHostKeyFingerPrint:
The fingerprint of the server key to accept.This may be set to a comma-delimited collection of 16-byte MD5 fingerprints that should be accepted as the host's key. You may supply it by HEX
encoding the values in the form "0a:1b:2c:3d". Example:
SSHClient.Config("SSHAcceptServerHostKeyFingerprint=0a:1b:2c:3d");
If the server's fingerprint matches one of the values supplied, the cmdlet will accept the host key.
|
|||||||||||||||||||
SSHFingerprintHashAlgorithm:
The algorithm used to calculate the fingerprint.This configuration setting controls which hash algorithm is used to calculate the hostkey's fingerprint, displayed when SSHServerAuthentication fires.
Valid values are:
|
|||||||||||||||||||
SSHFingerprintMD5: The server hostkey's MD5 fingerprint.This setting may be queried in SSHServerAuthentication to get the server hostkey's MD5 fingerprint. | |||||||||||||||||||
SSHFingerprintSHA1: The server hostkey's SHA1 fingerprint.This setting may be queried in SSHServerAuthentication to get the server hostkey's SHA1 fingerprint. | |||||||||||||||||||
SSHFingerprintSHA256: The server hostkey's SHA256 fingerprint.This setting may be queried in SSHServerAuthentication to get the server hostkey's SHA256 fingerprint. | |||||||||||||||||||
SSHKeepAliveCountMax: The maximum number of keep alive packets to send without a response.This setting specifies the maximum number of keep alive packets to send when no response is received. Normally a response to a keep alive packet is received right away. If no response is received the cmdlet will continue to send keep alive packets until SSHKeepAliveCountMax is reached. If this is reached the cmdlet will assume the connection is broken and disconnect. The default value is 5. | |||||||||||||||||||
SSHKeepAliveInterval:
The interval between keep alive packets.This setting specifies the number of seconds between keep alive packets. If set to a positive value
the cmdlet will send a SSH keep alive packet after KeepAliveInterval seconds of inactivity.
This setting only takes effect when there is no activity, if any data is sent or received over the connection
it will reset the timer.
The default value is 0 meaning no keep alives will be sent. Note: The SSHREVERSETUNNEL cmdlet uses a default value of 30. |
|||||||||||||||||||
SSHKeyExchangeAlgorithms:
Specifies the supported key exchange algorithms.This may be used to specify the list of supported Key Exchange algorithms used during SSH negotiation. The value should contain
a comma separated list of algorithms. Supported algorithms are:
|
|||||||||||||||||||
SSHKeyRenegotiate:
Causes the component to renegotiate the SSH keys.Once this setting is set the component will renegotiate the SSH keys with the remote host.
Example:
|
|||||||||||||||||||
SSHMacAlgorithms:
Specifies the supported Mac algorithms.This may be used to specify an alternate list of supported Mac algorithms used during SSH negotiation. This also specifies the order in which the Mac algorithms are preferred.
The value should contain a comma separated list of algorithms. Supported algorithms are:
|
|||||||||||||||||||
SSHPubKeyAuthSigAlgorithms:
Specifies the enabled signature algorithms that may be used when attempting public key authentication.This setting specifies a list of signature algorithms that may be used when authenticating
to the server using public key authentication. This applies only when public key authentication
is performed by the client.
The setting should be a comma separated list of algorithms. At runtime the cmdlet will evaluate the specified algorithms and if the algorithm is applicable to the certificate specified in SSHCert it will be used. If the algorithm is not applicable the cmdlet will evaluate the next algorithm. Possible values are:
The default value in Windows is ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519. rsa-sha2-256 and rsa-sha2-512 notes The cmdlet will query the server for supported algorithms when connecting. If the server indicates support for rsa-sha2-256 or rsa-sha2-512 and the algorithm is present in the list defined by this setting (as in the default value), that algorithm will be used instead of ssh-rsa even when ssh-rsa appears first in the list. For the rsa-sha2-256 and rsa-sha2-512 algorithms to be automatically preferred the server must support the ext-info-c mechanism. In practice, older servers do not support this and in that case ssh-rsa will be used since it appears first in the list. Newer servers do support this mechanism and in that case rsa-sha2-256 or rsa-sha2-512 will be used even though it appears after ssh-rsa. This behavior has been carefully designed to provide maximum compatibility while automatically using more secure algorithms when connecting to servers which support them. |
|||||||||||||||||||
SSHPublicKeyAlgorithms:
Specifies the supported public key algorithms for the server's public key.
This setting specifies the allowed public key algorithms for the server's public key. This list controls only the public key
algorithm used when authenticating the server's public key. This list has no bearing on the public key algorithms
that can be used by the client when performing public key authentication to the server. The default value is ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-256,rsa-sha2-512,ssh-rsa,ssh-dss,x509v3-sign-rsa,x509v3-sign-dss.
|
|||||||||||||||||||
SSHVersionPattern:
The pattern used to match the remote host's version string.This configuration setting specifies the pattern used to accept or deny the remote host's SSH version string. It takes a comma-delimited list of patterns to match. The default value is "*SSH-1.99-*,*SSH-2.0-*" and will accept connections from SSH 1.99 and 2.0 hosts. As an example, the below value would accept connections for SSH 1.99, 2.0, and 2.99 hosts.
*SSH-1.99-*,*SSH-2.0-*,*SSH-2.99-* |
|||||||||||||||||||
TryAllAvailableAuthMethods: If set to true, the cmdlet will try all available authentication methods.The default value is false. When set to true, the cmdlet will try to authenticate using all methods that it has credentials for and the server supports. | |||||||||||||||||||
WaitForChannelClose:
Whether to wait for channels to be closed before disconnected.This setting controls whether the cmdlet will wait for a server response to the SSH_MSG_CHANNEL_CLOSE when disconnecting. When the cmdlet disconnects it will first attempt to close all open channels by sending a SSH_MSG_CHANNEL_CLOSE for each channel. This setting controls whether the cmdlet will wait for a server response after sending the messages.
When True (default) the cmdlet will wait for a response to the channel close message until the responses have been received, the server closes the connection, or Timeout seconds is reached. When False the cmdlet will still send the channel close messages but will not wait for a response and will proceed to close the connection. |
|||||||||||||||||||
WaitForServerDisconnect:
Whether to wait for the server to close the connection.This setting controls whether to wait for the server to close the connection when SSHLogoff is called.
When set to True the cmdlet will initiate the disconnection sequence by sending SSH_MSG_DISCONNECT but will not close the connection, and instead will wait for the server to close the connection. Setting this to True may be beneficial in circumstances where many connections are being established, to avoid port exhaustion when sockets are in a TIME_WAIT state. Allowing the server to close the connection avoids the TIME_WAIT state of socket on the client machine. When set to False (default) the client will close the connection. It is recommended to use this value unless there is a specific need to change it. |
TCPClient Config Settings
ConnectionTimeout: Sets a separate timeout value for establishing a connection.When set, this configuration setting allows you to specify a different timeout value for establishing a connection. Otherwise, the cmdlet will use Timeout for establishing a connection and transmitting/receiving data. | |||||||||||
FirewallAutoDetect: Tells the cmdlet whether or not to automatically detect and use firewall system settings, if available.This configuration setting is provided for use by cmdlets that do not directly expose Firewall properties. | |||||||||||
FirewallHost:
Name or IP address of firewall (optional).If a FirewallHost is given, requested connections will be authenticated through the specified firewall
when connecting.
If the FirewallHost setting is set to a Domain Name, a DNS request is initiated. Upon successful termination of the request, the FirewallHost setting is set to the corresponding address. If the search is not successful, an error is returned. Note: This setting is provided for use by cmdlets that do not directly expose Firewall properties. |
|||||||||||
FirewallPassword:
Password to be used if authentication is to be used when connecting through the firewall.If FirewallHost is specified, the FirewallUser and FirewallPassword settings
are used to connect and authenticate to the given firewall. If the authentication fails, the cmdlet throws an exception.
Note: This setting is provided for use by cmdlets that do not directly expose Firewall properties. |
|||||||||||
FirewallPort:
The TCP port for the FirewallHost;.The FirewallPort is set automatically when FirewallType is set to a valid value.
Note: This configuration setting is provided for use by cmdlets that do not directly expose Firewall properties. |
|||||||||||
FirewallType:
Determines the type of firewall to connect through.The appropriate values are as follows:
Note: This setting is provided for use by cmdlets that do not directly expose Firewall properties. |
|||||||||||
FirewallUser:
A user name if authentication is to be used connecting through a firewall.If the FirewallHost is specified, the FirewallUser and FirewallPassword
settings are used to connect and authenticate to the Firewall. If the authentication fails, the cmdlet throws an exception.
Note: This setting is provided for use by cmdlets that do not directly expose Firewall properties. |
|||||||||||
KeepAliveInterval:
The retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received.When set, TCPKeepAlive will automatically be set to True.
A TCP keep-alive packet will be sent after a period of inactivity as
defined by KeepAliveTime. If no acknowledgment is received from the remote host, the keep-alive packet
will be sent again. This configuration setting specifies the interval at which the successive keep-alive packets are sent in milliseconds.
This system default if this value is not specified here is 1 second.
Note: This value is not applicable in macOS. |
|||||||||||
KeepAliveTime: The inactivity time in milliseconds before a TCP keep-alive packet is sent.When set, TCPKeepAlive will automatically be set to True. By default, the operating system will determine the time a connection is idle before a Transmission Control Protocol (TCP) keep-alive packet is sent. This system default if this value is not specified here is 2 hours. In many cases, a shorter interval is more useful. Set this value to the desired interval in milliseconds. | |||||||||||
Linger:
When set to True, connections are terminated gracefully.This property controls how a connection is closed. The default is True.
In the case that Linger is True (default), two scenarios determine how long the connection will linger. In the first, if LingerTime is 0 (default), the system will attempt to send pending data for a connection until the default IP timeout expires. In the second scenario, if LingerTime is a positive value, the system will attempt to send pending data until the specified LingerTime is reached. If this attempt fails, then the system will reset the connection. The default behavior (which is also the default mode for stream sockets) might result in a long delay in closing the connection. Although the cmdlet returns control immediately, the system could hold system resources until all pending data are sent (even after your application closes). Setting this property to False forces an immediate disconnection. If you know that the other side has received all the data you sent (e.g., by a client acknowledgment), setting this property to False might be the appropriate course of action. |
|||||||||||
LingerTime: Time in seconds to have the connection linger. LingerTime is the time, in seconds, the socket connection will linger. This value is 0 by default, which means it will use the default IP timeout. | |||||||||||
LocalHost:
The name of the local host through which connections are initiated or accepted.
The LocalHost setting contains the name of the local host
as obtained by the gethostname() system call, or if the
user has assigned an IP address, the value of that address.
In multi-homed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the cmdlet initiate connections (or accept in the case of server cmdlets) only through that interface. If the cmdlet is connected, the LocalHost setting shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multi-homed hosts (machines with more than one IP interface). |
|||||||||||
LocalPort:
The port in the local host where the cmdlet binds.
This must be set before a connection is
attempted. It instructs the cmdlet to bind to a specific
port (or communication endpoint) in the local machine.
Setting this to 0 (default) enables the system to choose a port at random. The chosen port will be shown by LocalPort after the connection is established. LocalPort cannot be changed once a connection is made. Any attempt to set this when a connection is active will generate an error. This; setting is useful when trying to connect to services that require a trusted port in the client side. An example is the remote shell (rsh) service in UNIX systems. |
|||||||||||
MaxLineLength:
The maximum amount of data to accumulate when no EOL is found.MaxLineLength is the size of an internal buffer, which holds received data while waiting for an EOL
string.
If an EOL string is found in the input stream before MaxLineLength bytes are received, the DataIn event is fired with the EOL parameter set to True, and the buffer is reset. If no EOL is found, and MaxLineLength bytes are accumulated in the buffer, the DataIn event is fired with the EOL parameter set to False, and the buffer is reset. The minimum value for MaxLineLength is 256 bytes. The default value is 2048 bytes. |
|||||||||||
MaxTransferRate: The transfer rate limit in bytes per second.This configuration setting can be used to throttle outbound TCP traffic. Set this to the number of bytes to be sent per second. By default, this is not set and there is no limit. | |||||||||||
ProxyExceptionsList:
A semicolon separated list of hosts and IPs to bypass when using a proxy.This configuration setting optionally specifies a semicolon-separated list of hostnames or IP addresses to bypass when a proxy is in use.
When requests are made to hosts specified in this property, the proxy will not be used. For instance:
www.google.com;www.nsoftware.com |
|||||||||||
TCPKeepAlive:
Determines whether or not the keep alive socket option is enabled.If set to True, the socket's keep-alive option is enabled and keep-alive packets will be sent periodically
to maintain the connection. Set KeepAliveTime and KeepAliveInterval to
configure the timing of the keep-alive packets.
Note: This value is not applicable in Java. |
|||||||||||
TcpNoDelay:
Whether or not to delay when sending packets.
When true, the socket will send all data that is ready to send at once. When
false, the socket will send smaller buffered packets of data at small intervals.
This is known as the Nagle algorithm.
By default, this config is set to false. |
|||||||||||
UseIPv6:
Whether to use IPv6.When set to 0 (default), the cmdlet will use IPv4 exclusively.
When set to 1, the cmdlet will use IPv6 exclusively. To instruct the cmdlet to prefer IPv6 addresses, but use IPv4 if IPv6 is not supported on the system, this setting should be set to 2. The default value is 0.
Possible values are:
|
Socket Config Settings
AbsoluteTimeout:
Determines whether timeouts are inactivity timeouts or absolute timeouts.If AbsoluteTimeout is set to True, any method which does not complete within Timeout seconds
will be aborted. By default, AbsoluteTimeout is False, and the timeout is an inactivity timeout.
Note: This option is not valid for UDP ports. |
|
FirewallData: Used to send extra data to the firewall.When the firewall is a tunneling proxy, use this property to send custom (additional) headers to the firewall (e.g. headers for custom authentication schemes). | |
InBufferSize:
The size in bytes of the incoming queue of the socket.
This is the size of an internal queue in the TCP/IP stack.
You can increase or decrease its size depending on the amount
of data that you will be receiving. Increasing the value of the
InBufferSize setting can provide significant improvements in
performance in some cases.
Some TCP/IP implementations do not support variable buffer sizes. If that is the case, when the cmdlet is activated the InBufferSize reverts to its defined size. The same happens if you attempt to make it too large or too small. |
|
OutBufferSize:
The size in bytes of the outgoing queue of the socket.This is the size of an internal queue in the TCP/IP stack.
You can increase or decrease its size depending on the amount
of data that you will be sending. Increasing the value of the
OutBufferSize setting can provide significant improvements in
performance in some cases.
Some TCP/IP implementations do not support variable buffer sizes. If that is the case, when the cmdlet is activated the OutBufferSize reverts to its defined size. The same happens if you attempt to make it too large or too small. |
Base Config Settings
BuildInfo: Information about the product's build.When queried, this setting will return a string containing information about the product's build. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CodePage:
The system code page used for Unicode to Multibyte translations.The default code page is Unicode UTF-8 (65001).
The following is a list of valid code page identifiers:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
LicenseInfo:
Information about the current license.When queried, this setting will return a string containing information about the license this instance of a cmdlet is using. It will return the following information:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MaskSensitive:
Whether sensitive data is masked in log messages.In certain circumstances it may be beneficial to mask sensitive data, like passwords, in log messages. Set this to true to mask sensitive data. The default is false.
This setting only works on these cmdlets: AS3Receiver, AS3Sender, Atom, Client(3DS), FTP, FTPServer, IMAP, OFTPClient, SSHClient, SCP, Server(3DS), Sexec, SFTP, SFTPServer, SSHServer, TCPClient, TCPServer. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
UseInternalSecurityAPI:
Tells the cmdlet whether or not to use the system security libraries or an internal implementation.
When set to false, the cmdlet will use the system security libraries by default to perform cryptographic functions where applicable.
In this case, calls to unmanaged code will be made. In certain environments this is not desirable.
To use a completely managed security implementation set this setting to true.
Setting this setting to true tells the cmdlet to use the internal implementation instead of using the system security libraries. On Windows, this setting is set to false by default. On Linux/macOS, this setting is set to true by default. If using the .NET Standard Library, this setting will be true on all platforms. The .NET Standard library does not support using the system security libraries. Note: This setting is static. The value set is applicable to all cmdlets used in the application. When this value is set the product's system DLL is no longer required as a reference, as all unmanaged code is stored in that file. |