Script won't run non-interactively

Advertisement

Larz
Joined:
Posts:
1
Location:
DK

Script won't run non-interactively

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?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,262
Location:
Prague, Czechia

Re: Script won't run non-interactively

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 winscp.com (not .exe) and redirect its output to a file. Inspect the file afterwards.
- From the .bat file, log an exit code of WinSCP

Reply with quote

alexsts
Joined:
Posts:
5

post more details on how our job is setup

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...

Reply with quote

encotrio
Guest

Re: Script won't run non-interactively

I have this issue and fixed by fixing the "log on as a batch job".

When you schedule tasks under a particular user name and password (not domain user), automatically the user is assigned the Log on as a batch job user right. Task Scheduler service logs on the user as a batch job when the scheduled time arrived.

Check carefully the "Local Security Policy Manager".

Reply with quote

Advertisement

You can post new topics in this forum