Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
canoebi99
Partner - Creator
Partner - Creator

Issue with scheduled task to email QV pdf report

We have an issue with a process running through windows task scheduler.

The process launches a bat file which in turn launches Qlikview and reloads a Qlikview template. It then closes Qlikview and reopens it, the second time running a macro within Qlikview. The macro runs a Qlikview report and attempts to print this to pdf using the QlikviewPDF printer driver installed on the server. It then saves the pdf file into C:\temp before attaching it to an e-mail and sending it out. Finally it deletes the file and then runs the report again looping through each employee.

This process runs successfully when it is run manually by executing the bat file. It also runs successfully through windows task scheduler (by right clicking the task and selecting run, as long as the "run only when user is logged" on option is selected on the task.

However, if we set the scheduled task to “run whether user is logged on or not” the task starts and the process begins but it hangs part way through.

run whether logged on or not.jpg

The process seems to fail at the point that it attempts to print the report to pdf and save it into C:\temp. Whether it is the actual printing (i.e. can’t find the printer driver) or the saving to C:\temp part that fails I am unsure of. It then hangs when it tries to attach the file to the e-mail because the file doesn't exist.

The scheduled task has been configured to run under the same account that works when I run it with the setting "run only when user logged on".  (We also have other scheduled processes running under this account that work fine although they are writing csv files rather than printing to pdf)

Is there anything that anyone can think of (like group policies etc) that would stop this task from printing the pdf with the setting “run whether user is logged on or not” (I have tried other folder locations with the same result and yet all security permissions on the folders look ok so I am thinking it is something around the printer driver not being able to used with this setting). I do have exactly the same code running elsewhere on the same operating system without an issue which makes me think it must be network specific? It is a 2008R2 server.

5 Replies
marcus_sommer

I know this issue but I haven't any solution unless to be always logged in. I think the reason are security settings onto the local machine especially the access rights within the file-system.

- Marcus

canoebi99
Partner - Creator
Partner - Creator
Author

Thanks Marcus, staying logged in isn't an option on this site, hence my post. I can't see it being access rights to the file system because we can write a csv to the same location using the same process. cheers anyway.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

If you have a comparable set-up on another identical server and that one works, it must be something in the printer driver environment.

How about removing and installing the printer driver again?

Peter

canoebi99
Partner - Creator
Partner - Creator
Author

Thanks Peter but this one works ok when we set to run when the user is is logged in. So the printer driver is working ok ... it just seems that something fails with it when we choose the "run whether user logged in or not".

I guess what I need to know is if there are any group policy settings or the like that might cause a printer driver not to be available when using that option. As you say if it works elsewhere on that option (and works here with run when user logged in) then it must be something locally set that is stopping it .... just what is the question? Reinstalling the printer driver surely wouldn't change that setting ... although I will try because I have tried everything else! Cheers.

marcus_sommer

If you are not logged in then none of your users will be really applied, even if you used batches with "runas". It will be used a system account from windows and this account could haven't all rights which it needed. Further some tasks require a kind of visibility which means they run with default settings not as background-process.

I think it will be difficult to find the real reason. Firstly you should look at the windows event/error logging and then on a detailed level use a process explorer.

- Marcus