If I take your code, add acceptable values to the constants, I get this output:
What do you get? Isn't your code throwing an exception? Do you check the script output or only the log file? If only the log file, you will need to capture exceptions as well. Or use
See https://winscp.net/eng/docs/guide_debugging_scheduler#powershell
Btw, you are missing
[2020-07-12 10:52:39] | INFO | SFTP server responded to ping
[2020-07-12 10:52:39] | DEBUG | SomeUserName@sftp
...
What do you get? Isn't your code throwing an exception? Do you check the script output or only the log file? If only the log file, you will need to capture exceptions as well. Or use
Start-Transcript
.
See https://winscp.net/eng/docs/guide_debugging_scheduler#powershell
Btw, you are missing
$
in sftpSource = "/IntegrationFiles/"
.