Post a reply

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: Powershell session.putfiles: Getting 'Host "hostname sourcefile destfile" does not exist'

Show us your code and a full session log file showing the problem (using the latest version of WinSCP).

To generate 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.
David Griswold

Powershell session.putfiles: Getting 'Host "hostname sourcefile destfile" does not exist'

I am using the Powershell putfile example, with a few changes, and wrapped in a function. When I call $session.putfiles I get a strange error (sanitized):

Host "hostname.domain c:\localpath\localfile /remotepath/remotefile" does not exist.

I only need to copy one file and it exists on the remote side, but I think I read that overwrite is true by default. I had a wildcard in the source originally, but I changed it to have the exact filename.

I know that the host exists, because steps in the script before the call to copy the file work with the same variables. Let me know if you need me to include my code.

Thanks,
David Griswold