简体   繁体   中英

error when running psftp with Powershell

I am calling psftp.exe from a powershell script and whilst it downloads the specified file/s correctly and functions as expected, the error (below) is thrown to the command line output which as far as I can tell has no material impact on the process as a whole.

.\psftp.exe : Looking up host "hostname.com"
At line:2 char:1
+ .\psftp.exe 'hostname.com' -l 'username' -pw 'password ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Looking up host "hostname.com":String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

Connecting to <HostIP> port <PortNo.>
Server version: <Version>
Using SSH protocol <Version>
We claim version: <Version>
Host key fingerprint is:
<key>
Using username "<username>".
Attempting keyboard-interactive authentication
Access granted
Opening session as main channel
Opened main channel
Started a shell/command
Sent EOF message
Server sent command exit status 0
Disconnected: All channels closed

Does anyone know what this error is suggesting. Surely if any of the credentials being passed were wrong the session wouldn't connect and download the files correctly?

The script is below for completeness:

.\psftp.exe 'hostname.com' -l 'username' -pw 'Pass' -P 'portNo' -v -b 'GetFiles.txt' # -be -bc

Based on the response marked as the solution, I have amended to (.\\psftp.exe 'hostname.com' -l 'username' -pw 'Pass' -P 'portNo' -v -b 'GetFiles.txt') 2> $null

Looks like all verbose messages are written to stderr (easy to confirm by running the same command with 2> $null at the end).

In "normal" PowerShell.exe it shouldn't be visible, ISE will encapsulate anything that shows up in standard error in exceptions (as you've noticed).

Are you running psftp.exe in PowerShell ISE? If yes you may want to use one of techniques I've suggested for similar problem with git in ISE .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM