Help with MS Access to PowerShell FTP download

Advertisement

shenson
Joined:
Posts:
1
Location:
Phoenix

Help with MS Access to PowerShell FTP download

I have automated an email in VBA in Access. Now I'm trying to use PowerShell to download a file, from there Access will import it. I have been having through with Downloading it though, it logs in fine, but is having trouble downloading.
This is my VBA call function.
Function FTP2()
    runSendreports = Shell("Powershell.exe -executionpolicy bypass C:\Program Files\Tasks\FTP.ps1")
End Function

I bypassed that and just tested it with PowerShell and turned on WinSCP logs
& "C:\Program Files (x86)\WinSCP\WinSCP.com" `
  /log="C:\writable\path\to\log\WinSCP.log" /ini=nul `
  /command `
    "open sftp://root:root@192.16x.x.xx/ -hostkey=`"`"ssh-ed519 255 TS/UKKyryg2jo0WN`"`" -rawsettings FSProtocol=2" `
    "cd /usr/share/astguiclient/Scripts" `
    "lcd C:\Shared\BPFilesIn" `
    "get tbl_export.xlsx" `
    "exit"
 
$winscpResult = $LastExitCode
if ($winscpResult -eq 0)
{
  Write-Host "Success"
}
else
{
  Write-Host "Error"
}
 
exit $winscpResult
From the logs it looks like it logs in, does that hand shake at least, the download doesn't work.

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum