Trouble With PowerShell Upload - Cannot

Advertisement

deathtron
Guest

Trouble With PowerShell Upload - Cannot

Hi Everyone,

I am trying to do a simple sftp upload with poswershell. It looks like my command to transfer the file is not picking up at all. My command looks like this:
& "C:\Program Files (x86)\WinSCP\WinSCP.com" `
  /log="C:\writable\path\to\log\WinSCP.log" /ini=nul `
  /command `
    "open sftp:// (removed by poster)
    "Put C:\Test\*.*"  `
    
    "exit"
 
$winscpResult = $LastExitCode
if ($winscpResult -eq 0)
{
  Write-Host "Success"
}
else
{
  Write-Host "Error"
}
 
exit $winscpResult
And my output in PowerShell looks like this:
PS C:\> C:\Users\xxxx\Downloads\test_shell.ps1
Error occurred during logging. It's been turned off.
Can't open log file 'C:\writable\path\to\log\WinSCP.log'.

System Error.  Code: 2.

The system cannot find the file specified
Searching for host...
Connecting to host...
Authenticating...
Using username xxxx
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Session started.
Active session: [1] xxxx
exit
Error

Any thoughts on what I did wrong?

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum