PowerShell does not come with cmdlets to download and upload data via FTP. However, you can use .NET for this.

To download a file from an FTP server, try using this code:

$localFile = "C:\test.txt"

$username='testuser'
$password='[email protected]'

[System.Uri]$uri = "ftp://${username}:[email protected]/test.txt"
$webclient = [System.Net.WebClient]::new()
$webclient.DownloadFile($uri, $localFile)
$webclient.Dispose()




Twitter This Tip! ReTweet this Tip!

Anonymous