Get-FTP Cmdlet
Parameters Output Objects Configuration Settings
The Get-FTP cmdlet is used to download files and retrieve directory listings from FTP, SFTP, and FTPS servers.
Syntax
Get-FTP [parameters]
Remarks
This cmdlet implements a standard FTP client, as specified in RFC 959 and RFC 1579. In addition, it also includes the added option of SSL security (RFC 2228) in both the protocol and data channels.
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.
To use FTPS (SSL-enabled FTP), set SSL to True.
This cmdlet handles listing directories and downloading files. To upload files please see the SEND-FTP 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.
# Retrieve all txt files from a subdirectory on a FTP server
Get-FTP -Server ftp_server -User user -Password password -RemoteFile Folder1/SubFolder/*.txt
# Lists all .txt file on a FTP server.
Get-FTP -Server ftp_server -Cred $cred -List *.txt -SSL
explicit
Connection Handling
This cmdlet supports persistent connections through the Connection parameter. To establish a new FTP connection, use the Connect-FTP cmdlet. To close the connection, use the Disconnect-FTP 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. |
ActiveMode | Controls whether to direct the server into active mode. |
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 cmdlet. |
BeforeDownload | A set of FTP commands to be executed immediately before each file is downloaded. |
Binary | Forces binary transfer mode for FTP and FTPS connections. |
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. |
Config | Specifies one or more configuration settings. |
Credential | The PSCredential object to use for user/password authentication. |
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 cmdlet 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. |
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. |
SSL | Determines how the cmdlet starts SSL negotiation. |
SSLAccept | The encoded public key of the certificate which is to be trusted 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. |
Configuration Settings
The following is a list of configuration settings for the cmdlet with short descriptions. Click on the links for further details.
UseFSwitch | Specifies whether or not the -F parameter is used when listing directory contents. |
UseSimpleDirList | Instructs the adapter to issue the NLST command instead of LIST. |
ActiveModePORTAddress | Allows the specification of the PORT address value for active mode connections. |
ActiveModeIP | Allows the specification of the IP address that the server will connect to for active mode connections. |
AppendToLocalFile | Append downloaded files to a local file. |
AutoSelectDataIP | Automatically select the data connection IP. |
CalculatePercentDone | Enables or Disables calculating the percent complete for downloads. |
CheckTotalEntry | Whether to ignore directory listing total lines. |
DILinger | When set to True, DI connections are terminated gracefully. |
DILingerTime | Time in seconds to have the DI connection linger. |
IgnoreEntries | Directory entry data to ignore. |
FileTimeFormat | The format of file time reported by the server. |
MaskSensitive | Masks passwords in logs. |
PortRange | Allows the specification of a port range where the cmdlet listens for active mode connections. |
PreserveFileTime | Attempts to preserve timestamps when transferring files. |
RealTimeUpload | Enables real time uploading. |
RealTimeUploadAgeLimit | The age limit in seconds when using RealTimeUpload. |
ReuseSSLSessionInDI | Whether the SSL session will be reused for the DI connection. |
ReusePISSLSessionInDI | Whether the PI SSL session will be reused for the DI connection. |
UseEPSV | Allows extended passive mode. |
UseMLSD | Uses listings for machine processing. |
UseMLST | Uses single file listing for machine processing. |
UseModeZ | Allows compression to be used when transferring data. |
ModeZCompressionLevel | Used to specify the level of compression used. |
UseRemoteHostAddressForPassive | Instructs the cmdlet to use the address specified by RemoteHost when establishing a data connection. |
UseClearChannel | Allows for the Clear Command Channel (CCC) command. |
UseClearDataChannel | Allows for the PROT C command. |
UseOldAUTHSSL | Allows use of the 'AUTH SSL' command instead of 'AUTH TLS'. |
UseProtWhenImplicit | Sends the PROT P command to the server. |
VirtualHostName | Sends the HOST command to the server. |
ConnectionTimeout | Sets a separate timeout value for establishing a connection. |
FirewallAutoDetect | Tells the cmdlet 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. |
KeepAliveTime | The inactivity time in milliseconds before a TCP keep-alive packet is sent. |
KeepAliveInterval | The retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received. |
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 cmdlet 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. |
UseIPv6 | Whether to use IPv6. |
TcpNoDelay | Whether or not to delay when sending packets. |
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. |
UseBackgroundThread | Whether threads created by the cmdlet are background threads. |
UseInternalSecurityAPI | Tells the cmdlet whether or not to use the system security libraries or an internal implementation. |