Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
dpduran
Contributor III
Contributor III

Publisher - Run task with execute command

Hi all,

I've been working in a project where I need to run a sub where I execute CMD to run an external app recursively as per a table generated in my QVW.

The thing is, when I schedule that app to reload in my Publisher, it runs without errors, but apparently it won't run the external commands.


I don't know what to do really, as all system access privileges and stuff is checked in the script and app...


This is the Statement I have in my code that won't run... the thing is when I run the app manually, it works both with my account and with the service account used by the publisher server.

So apparently it is not a folder/execution permission issue... !

sub.jpg

Any suggestions to run this as a task from Publisher?

1 Solution

Accepted Solutions
dpduran
Contributor III
Contributor III
Author

Hi Rob,

thanks for your suggestions. Apparently due to security settings, I was using network paths and that is not allowed when I launch cmd.exe in my server. It actually was not just that I was using paths to launch the stuff I needed, it is also the path where it starts as we use a network file share machine to store the qvw.

When a cmd is launched from there, It tries to use that folder as it's starting point, but due to security settings, it takes you back to Windows directory.
Then, relative paths from there don't work as it's not your qvw folder so it won't work at all.
In addition to the starting folder for the CMD it's the network paths not being recognized properly when executing enything else, so fixed straight await with this:

I just added an execute command at the beggining of the script to map to a drive the network path I wanted and after that I changed all paths to use that unit instead of network \\whatever paths

execute cmd.exe c/ NET USE Z: "\\path"

Now it works from Publisher without any problem at all.


I've searched for the AllowExecuteCommand in my settings.ini file and it's not there, but as you say in your useful blog post, it is by default set to 1 so I guess either I looked in the wrong place or it doesn't need to be declared in the settings file to be 1 as it's the default.

Anyway. It's working now.

Thanks!

Edit: I'm marking my answer as correct so It appears as solved.

View solution in original post

8 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Which version and SR of QlikView?

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

dpduran
Contributor III
Contributor III
Author

Hi Rob,

thanks for getting in touch, we're running a clustered environment with version 11.20.12904.0 That is SR12 If I'm not wrong.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Are you aware of the new AllowExecuteCommand switch in SR11?

Authorizing the Script EXECUTE Statement | Qlikview Cookbook

I believe the default in SR11 is allow, and you didn't say your script was failing, so this is probably not the issue.

Do those bat files refer to drive letters or something that won't work in a service? Do you see any orphaned cmd.exe tasks in Task Manager on the server?

Can you try ECHO a message from the bat file to a file to see if the task is actually executing?

-Rob

dpduran
Contributor III
Contributor III
Author

Hi Rob,

thanks for your suggestions. Apparently due to security settings, I was using network paths and that is not allowed when I launch cmd.exe in my server. It actually was not just that I was using paths to launch the stuff I needed, it is also the path where it starts as we use a network file share machine to store the qvw.

When a cmd is launched from there, It tries to use that folder as it's starting point, but due to security settings, it takes you back to Windows directory.
Then, relative paths from there don't work as it's not your qvw folder so it won't work at all.
In addition to the starting folder for the CMD it's the network paths not being recognized properly when executing enything else, so fixed straight await with this:

I just added an execute command at the beggining of the script to map to a drive the network path I wanted and after that I changed all paths to use that unit instead of network \\whatever paths

execute cmd.exe c/ NET USE Z: "\\path"

Now it works from Publisher without any problem at all.


I've searched for the AllowExecuteCommand in my settings.ini file and it's not there, but as you say in your useful blog post, it is by default set to 1 so I guess either I looked in the wrong place or it doesn't need to be declared in the settings file to be 1 as it's the default.

Anyway. It's working now.

Thanks!

Edit: I'm marking my answer as correct so It appears as solved.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

I noticed that you are either using no path or a relative path to specify the location of your external executables. Try adding full path specifications (start with an existing drive letter, not one you mapped yourself).

Best,

Peter

dpduran
Contributor III
Contributor III
Author

Hi Peter,

thanks for popping up, it was al related to CMD security settings.

I added a net use command at the beggining of the script and used that drive to reference the bat and executable files I was refering with the execute command.Now everything is working fine

Thanks!

Not applicable

Hi @Diego Perez,

I am facing the same issue.

On my Qlikview server I have R installed, on the E drive I have the R script, which is being Called by a Batch file (ReloadR.bat)

In Qlikview Script I am using following:

     EXECUTE cmd /C "E:\Project\R Analytics\ReloadR.bat";

It works fine locally, but when used with Publisher, it completes running without running the batch file.

All execution done on one server machine, nowhere are network paths being used.

Please help.

Thanks,

Swapneel

dpduran
Contributor III
Contributor III
Author

swapneel22

Have you checked all permissions are correctly set?


Try opening the doc in Desktop client, go to Settings > User Preferences > Security tab


Then check if it's unchecked the option that says :


"Script (Allow Database Write and Execute Statements)"