Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: WinSCP not generating log file when command is executed on another computer

Do you realize that the log file is generated on the remote machine?

Did you try using winscp.com instead of winscp.exe and capture its console output to check for errors?
nanderson

WinSCP not generating log file when command is executed on another computer

I'm initiating a file transfer from a database server, but I need to use my web server to transfer the file, as that is the whitelisted IP. I'm initiating the transfer from a powershell script, and passing in parameters dynamically.

When I log the command, I can see that the dynamic parameters are being passed in as expected, but the log file is not begin generated.

I'm using the following command:

Invoke-Command -Computername "[computer name]" -ScriptBlock {

& "path/to/winscp.exe" /parameter "$($sftpConnection)" "$($sshKeyLocation)" "$($encryptedDataOutput)" "$($encryptedControlOutput)" /log="$($winSCPLogPath)" /command `
      'option batch abort'      `
      'option confirm off'      `
      'open %1% -hostkey=""[host key]"" -privatekey=%2%'   `
      'put -delete -nopreservetime %3% %4% ./incoming'   `
      'close'      `
      'exit'
}


When running the same script on the host machine, things work as expected.