I need a PowerShell script to upload to an SFTP site to a specific port number. It is currently working with FTP and when not connecting on a specific port but how would I edit my script to let it connect to a specific port and use SFTP? See my script below:
#we specify the directory where files are located to upload to Jevon FTP
$Dir="E:\CMBPAID\BPAID_JM_1360493_customer01_20180803_011700.csv"
#ftp server for Nest
$ftp = "sftp://ftp.dlptest.com/"
$user = "dlpuser@dlptest.com"
$pass = "e73jzTRTNqCN9PYAAjjn"
$webclient = New-Object System.Net.WebClient
$webclient.Credentials = New-Object
System.Net.NetworkCredential($user,$pass)
#list sql server trace file
foreach($item in (dir $Dir "*.trc")) {
"Uploading $item..."
$uri = New-Object System.Uri($ftp+$item.Name)
$webclient.UploadFile($uri, $item.FullName)
}