This should work as a PowerShell replacement for the VB code you posted:
Add-Type -AssemblyName PresentationFramework
Function FtpDownload{
param(
[string]$RemoteFile,
[string]$LocalFile,
[string]$HostName,
[string]$User,
[string]$Pass
)
$ftp = "ftp://{0}:{1}@{2}{3}" -f $User,$Pass,$HostName,$RemoteFile
$uri = New-Object -TypeName System.Uri -ArgumentList $ftp
$webclient = New-Object -TypeName System.Net.WebClient
$webclient.DownloadFile($uri, $File)
}
Function DownLoad{
Try{
FtpDownload -RemoteFile "/public_ftp/text.txt" `
-LocalFile "D:\town finance/text.txt" `
-HostName "server10.dn-server.com" `
-User "xxxxxx" `
-Pass "nnnnnn"
[System.Windows.MessageBox]::Show("download ok","Pars Royan","OK","Information") | Out-Null
}
Catch{
[System.Windows.MessageBox]::Show('fail',"Pars Royan","OK","Error") | Out-Null
}
}