Topic "Scripting feature"

Author Message
M. Rusu

Guest


Hello,

I would like to suggest implementing an enhanced scripting error handling. I want to be able for example to tell if an OPEN sftp command was successful or not.

This especially is very critical in our corporate environment. Let me explain why: if an user password has expired and he /she keeps trying to connect to the remote UNIX directory using our VB.net application, then the account locks and it may take a couple of days to unlock it. There are many steps to execute in the code, like moving, renaming files, etc. Not all of these steps can be checked for successful execution. I want to be able to stop execution at any time and display a meaningful error message.
It would be very useful to be able to display a message like "Authentication failed" or similar if an OPEN sftp command fails and also for every single WINSCP scripting command.

Best regards,
M.R. - Toronto
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
If you use "option batch abort", the scripts stops on any error and you can handle the situation as you like.
_________________
Martin Prikryl
Guest




Thank you for your answer.
I have set 'Option Batch Abort' in the VB.Net procedure but bothing happens if there is an error connecting to Unix. Execution just continues.

Here is my VB.Net code:

With oWinscp
' Feed in the scripting commands
.StandardInput.WriteLine("option batch abort")
.StandardInput.WriteLine("option confirm off")

'connect to Oracle directory
.StandardInput.WriteLine("open sftp://...user, password ...."
end with
more scripting commands....

How can I trap the error in VB.net if let's say the password is expired?

Regards,
M. Rusu
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
I wasn't able to reproduce your problem.

What version of WinSCP are you using?

If you have the latest one, create simple script file with:
option batch abort
option confirm off
open ....
put ....

Run the script and post the output of the script.
_________________
Martin Prikryl
M.R.

Guest


Hello,
Sorry for the late reply. I am using ver. 4.2.6
I think some clarification is needed. When I mentioned that 'execution continues' I was referring to execution of scripting commands in a VB.Net procedure. . I would like to have a way in Visual Basic.Net to trap errors that may occur in scripting and stop the execution at any point in my procedure...
Something like a 'return code' or maybe to have a complete error description in the xml log file.

Regards,
M. Rusu
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
You cannot do this with WinSCP.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License