FTP using PowerShell

FTP using PowerShell with an easy to use module.

John Savill

November 10, 2015

1 Min Read
FTP using PowerShell

Q. How can I FTP using PowerShell?

A. PowerShell has full access to .NET methods which has FTP capabilities however there are PowerShell modules available for download which expose these FTP capabilities as easy to use cmdlets. A great example library to use is available at https://gallery.technet.microsoft.com/scriptcenter/PowerShell-FTP-Client-db6fe0cb. Once you extract to your module path, for example C:WINDOWSSystem32WindowsPowerShellv1.0Modules the module can be loaded and used. Below is an example connection to a FTP server and its contents listed.

Import-Module PSFTP$FTPServer = 'ftp.host.com'$FTPUsername = 'username'$FTPPassword = 'password'$FTPSecurePassword = ConvertTo-SecureString -String $FTPPassword -asPlainText -Force$FTPCredential = New-Object System.Management.Automation.PSCredential($FTPUsername,$FTPSecurePassword)Set-FTPConnection -Credentials $FTPCredential -Server $FTPServer -Session MySession -UsePassive $Session = Get-FTPConnection -Session MySession Get-FTPChildItem -Session $Session -Path /htdocs #-Recurse

 

About the Author(s)

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like