Example powershell script from .NET assembly does not work

Advertisement

behemoth
Guest

Example powershell script from .NET assembly does not work

Hi,

I've been trying to get the "Deleting remote files after successful remote to local synchronization" script[*] from the examples to work, but without luck. The script runs for 2 seconds and then just ends. No error message. The files on the remote FTP server are neither downloaded nor removed.

I've only changed a few parameters: localpath, remotepath, hostname, username and password. I also commented out SshHostKeyFingerprint.

I added a few Write-Host debug messages to the script in order to see how far it goes, and it seems that it never enters the "foreach ($download in $synchronizationResult.Downloads)" loop.

Any hints?

[*] https://winscp.net/eng/docs/library_example_delete_after_successful_download

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
31,744
Location:
Prague, Czechia

Re: Example powershell script from .NET assembly does not work

What errors does it display?
Though if you have "commented out SshHostKeyFingerprint", it most likely fails because of that.

Reply with quote

behemoth
Guest

No errors. It just runs for a few seconds and then ends.

Is the SshHostKeyFingerprint option mandatory?

Adding a debug message before "foreach ($download in $synchronizationResult.Downloads)" prints the message, but adding the debug message after this line does not print any message. If that is of any help.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
31,744
Location:
Prague, Czechia

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Advertisement

You can post new topics in this forum