Topic "Script won't run non-interactively"

Author Message
[View user's profile]

Joined: 2013-06-19
Posts: 1
Location: DK
I am currently experiencing a problem getting my winScp file exchange to work when the user is not (interactively) logged on. This is a new setup, so it not like it worked, and then stopped working. I have tried to read the troubleshooting information without finding a solution.

I am running 5.1.5 on an Windows Server 2008 R2. I have set up a job in the Task Scheduler running with highest priviliges and configured for Windows 7 and Windows 2008 R2. The action of the task runs a bat file which calls Winscp with an ini file. Based on the result of the WinSCP job I perform certain actions of the files (as described in "Check results" section of the "Scripting and Automation" documentation). The Task Scheduler Job furthermore takes the working directory as "Start In" parameter.

The job runs in an account, having (seemingly) been given the necessary permissions.

The batfile takes an ini file as a parameter for the WinSCP tasks.

Whenever I run this job scheduled or manully via the Task Scheduler it works, provided that the security option on the Task Scheduler job is set to "Run only when user is logged on". As soon as I check the option "Run whether user is logged on or not" the batfile doesn't run. It doesn't even produce a logfile from WinSCP.

I have tried removing the call to WinSCP in the batfile, and then the rest of it works fine, no matter the security option chosen. So the account has access to the directory and to log on as a batch job.

I suspect, that the problem is that the script somehow gets run interactively, which the "Run whether user is logged on or not" does not support (the script windows does pop-up when it runs). But how can I prevent it from running interactively? Is it the way that I put an input to the batfile that creates a problem?

Any inputs, on getting this to work?
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26911
Location: Prague, Czechia
When running with user logged off:
- Does your .bat file finish or does it hang when running WinSCP?
- Can you try to add a line to the .bat that creates some file in the same folder, where WinSCP should write a session log (just to test the premissions)?
- Make sure you run (not .exe) and redirect its output to a file. Inspect the file afterwards.
- From the .bat file, log an exit code of WinSCP
Martin Prikryl
[View user's profile]

Joined: 2013-07-16
Posts: 5
I did had similar problem running batch processes on Windows 2008 server.
Are you sure that user who running job have permissions to do so?
As well if he has permission set on each folder involved in your process?
If you on the company network your local permissions may not be sufficient to overwrite network policies...

You can post new topics in this forum


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!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License