I want to connect with DTCC FTP server to get some credential files.
The program just creates the request file and then retrieves the produced data. Just need a script that does those two things.
$server="ftp 123.123.123.123"
$user="123456"
$passwd="123456"
$data_Password = "1234"
$RequestCode = "ABCD"
$locationCode= "ABCD"
$lastUsedSeqNum = "0560"
# Create file name for RequestFile
$scriptName = "FTX"+$user.Substring(0,4)+".P" + $user.Substring(5) + ".PB101" + $requestCode + "." + $locationCode + $lastUsedSeqNum
$scriptPath = (Resolve-Path .\).Path
Write-Host "Current Path is: "$scriptPath
$ScriptName = $MyInvocation.MyCommand.Nameame
Write-Host "Current running script name is: "$scriptName
$ftpFile=$scriptPath + "\$scriptName.I"
# Create RequestFile
$line1 = " "+"PPASSWD0102"+ " " +$user.Substring(0,4) +"-"+$user.Substring(5)+$data_Password + " " +$RequestCode.Substring(0,4) +$((Get-Date).ToString('HHMM'))+$lastUsedSeqNum
$line2 = "TD" +$RequestCode +"01HDR"
# Create RequestFile
Add-content $ftpFile $line1
Add-content $ftpFile $line2
I want to use powershell to implement this. Above is the code i am currently working on. This is to create a request file.
There is one thing that the scriptname is not working....
And i want to upload this to the server. Then wait for 15 min, to download the file from FTP server. I am really confused about powershell...
Help is always appreciated! thanks.