FTP Download Tips

Hi guys I’m new to Powershell and am trying to download files from a FTP server. I would like to know how I could do it with my credential format. My code is very incomplete and I’m not sure how to proceed. Any help would be greatly appreciated.

I did an export-clixml to save the credentials and am importing it on this script.

$ftpServer = ftp.example.com
$credPath = 'C:\Test\credFile.txt'
$credential | import-clixml -path $credPath

Well, there’s nothing native in PowerShell that understands the FTP protocol. You’re either going to have to find something that does (like NetCmdlets), or code it up in .NET yourself. Whether you can use clear-text credentials from a text file (bad idea) or not depends on the method you end up using.

You could also just use the ftp.exe command from within PowerShell. I believe it can be scripted to accept clear-text credentials.