Page 1 of 1
ExecuteCommand to run a batch file to open a program
Posted: Mon Nov 23, 2015 3:55 am
by tez
Hi
I'm trying to compile a TI process to run a batch file that will open Adobe Reader & a particular file name as saved in the .bat file.
If I run the .bat file directly, it all works correctly. Trying to run it via the TI process, it just seems to hang if I have a wait argument of 1, or says the process completed successfully if I have a wait argument of 0 (which I understand it will say completed successfully no matter what). It doesn't even open Adobe. I have other .bat files in the same directory that run chores & they all work perfectly.
My code in the TI process is....
Code: Select all
EXECUTECOMMAND ( 'E:\Batch_Files\CAFP0014_15Nov15.bat' ,0);
My .bat file code is...
Code: Select all
"C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" "E:\Finance\CAFP0014\Reports\2015\Nov\Activity_we_15-11-15.pdf"
Am I missing something or is it not possible to use ExecuteCommand to run some types of executables?
Many thanks
Terri
Re: ExecuteCommand to run a batch file to open a program
Posted: Mon Nov 23, 2015 4:09 am
by Alan Kirk
tez wrote:
I'm trying to compile a TI process to run a batch file that will open Adobe Reader & a particular file name as saved in the .bat file.
If I run the .bat file directly, it all works correctly. Trying to run it via the TI process, it just seems to hang if I have a wait argument of 1, or says the process completed successfully if I have a wait argument of 0 (which I understand it will say completed successfully no matter what). It doesn't even open Adobe. I have other .bat files in the same directory that run chores & they all work perfectly.
My code in the TI process is....
Code: Select all
EXECUTECOMMAND ( 'E:\Batch_Files\CAFP0014_15Nov15.bat' ,0);
My .bat file code is...
Code: Select all
"C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" "E:\Finance\CAFP0014\Reports\2015\Nov\Activity_we_15-11-15.pdf"
Am I missing something or is it not possible to use ExecuteCommand to run some types of executables?
I'm going to go out on (what I suspect is not an exceptionally long) limb here and guess that your intention is to show this .pdf on the client machine. And that you're running the batch file on the client side when you're testing it.
TI won't do that. It works on the server only.
If the TI is hanging when the wait argument is 1, my bet is that it's because Acrobat reader isn't installed on the server so the server is just generating an error message saying that it has no idea what AcroRd32.exe is. (Or if Acrobat
is installed, it's on a different path on the server.)
There is no
direct way of having TI execute something on a client machine; it would be a bit of a security risk if you could. There would certainly be some Heath Robinson constructs that you could use to get it to do so, but it would require the cooperation of other software running on the client machine. You could also just have the TI process e-mail the report, but that may have security implications.
If that's not it, and for some reason you really
did want this file to open on the TM1 server, I'd suggest making sure that the filepaths specified in the batch file are visible to the account that the TM1 server is running under. (I'm assuming that E:\ is a network share, so when you run the batch file the visibility may not be the same as when the server application runs it.)
Re: ExecuteCommand to run a batch file to open a program
Posted: Mon Nov 23, 2015 4:23 am
by tez
Hi Alan
Thanks for your speedy response.
Yes, all files/programs are on the TM1 server. Adobe is installed & the .bat file runs perfectly to open the .pdf when I double click on it within Windows Explorer.
It could possibly be an account security issue so I'll check that out.
Many thanks
Terri
Re: ExecuteCommand to run a batch file to open a program
Posted: Mon Nov 23, 2015 5:45 am
by Alan Kirk
tez wrote:Yes, all files/programs are on the TM1 server. Adobe is installed & the .bat file runs perfectly to open the .pdf when I double click on it within Windows Explorer.
It could possibly be an account security issue so I'll check that out.
Sorry, I'm a bit under the weather with a cold today so I wasn't clear enough.
It
can be a security issue
in the sense that if you test the batch file under a different account to the TM1 server service's account, you may get different results depending on both security
and, if the drive is
not a local one, drive mappings.
However... the only way that anyone will ever see that file is if they are remote desktop connected to the server using the TM1 service's account. When the batch file runs it will run under that account, it will open Acrobat on that account, and you'll only see Acrobat and the file if you yourself are also logged into the server under that account.
So to test that the batch file can actually run, you'd need to have done it under the TM1 service's account already. A test any other account would be meaningless. If you have in fact tested it under the TM1 server's account, it obviously can't be a security issue. If you haven't, then it can be, but it wouldn't have been a useful test (beyond checking the syntax of the batch file, anyway).
As an aside, while it's useful to be able to RDC onto a server using the TM1 server's own account to get under the hood when things go wrong (though some more security-obsessed IT departments may feel otherwise), I'm not sure that I'd be doing it on a daily basis to look at reports on the server. IMHO it's better to let the server run in isolation as much as possible. (Though I'll admit that it's not always possible to do so, with the proviso that the REST API will increase the number of things that can be done from a distance.)
Re: ExecuteCommand to run a batch file to open a program
Posted: Mon Nov 23, 2015 6:01 am
by tez
Hi Alan
Ok, so I've changed the account that runs all the TM1 services over to an administrator account of the TM1 server. I've also created this user account in TM1 (Cognos Express) as it's not using AD.
The E:\ is a partitioned drive on the TM1 server, & this account has full access to both C:\ & E:\. It's still not working when I'm logged in everywhere as this admin account.
Thanks for the update too, I didn't know that the user had to be the TM1 services account for it to work, so yes, it will prove to not be the answer I was looking for.
I am trying to allow a user to open a pdf doc from a menu I've created for TM1Web where they could select a week ending date (via subnm) & pass the (string) parameter to the TI process. I've was hoping to not need a complete list of all reports in the websheet using excel hyperlinks to the relevant pdf.
It's just a very small installation of Cognos Express, hence them logging into the vm via RDP to use TM1Web only.
Cheers
Terri
Re: ExecuteCommand to run a batch file to open a program
Posted: Mon Nov 23, 2015 1:42 pm
by tomok
Forget it. THIS WILL NOT WORK. You cannot open a file on the client via TurboIntegrator UNLESS THE CLIENT IS BEING RUN FROM THE SAME MACHINE THE SERVER IS RUNNING ON! What this means is you would have to be remoted into the server via RDP and then running Architect or Perspectives from there. If you are running the client from your own local machine then this scheme will not work.
Re: ExecuteCommand to run a batch file to open a program
Posted: Mon Nov 23, 2015 6:37 pm
by lotsaram
tez wrote:Hi Alan
Ok, so I've changed the account that runs all the TM1 services over to an administrator account of the TM1 server. I've also created this user account in TM1 (Cognos Express) as it's not using AD.
The E:\ is a partitioned drive on the TM1 server, & this account has full access to both C:\ & E:\. It's still not working when I'm logged in everywhere as this admin account.
Thanks for the update too, I didn't know that the user had to be the TM1 services account for it to work, so yes, it will prove to not be the answer I was looking for.
I am trying to allow a user to open a pdf doc from a menu I've created for TM1Web where they could select a week ending date (via subnm) & pass the (string) parameter to the TI process. I've was hoping to not need a complete list of all reports in the websheet using excel hyperlinks to the relevant pdf.
It's just a very small installation of Cognos Express, hence them logging into the vm via RDP to use TM1Web only.
Cheers
Terri
Are you trying to do it in the most round about way possible?
This is a pretty simple requirement to implement. Just place a hyperlink to the pdf file in the websheet menu page, job done! You can use standard excel formulas to parse the hyperlink so that it works via concatenating various bits and pieces to work with some naming convention based of selecting BU, date, product, market, etc. you name it. Or you could store the hyperlink value in a cube and pull it back with a DBR. The Excel Hyperlink formula also works in TM1 web so you can also have a friendly display name for the user like "click me to open a pdf".
Like Alan and Tom said you can't launch an application to a user's session via TurboIntegrator EVER, because TI is running on the server under the user running tm1sd. The user clicking a hyperlink however couldn't be much easier than that.
If the pdf documents are currently on a folder on the tm1 server somewhere then you are going to need to set up the directory or a root directory above as a web site virtual directory and give anon I_Usr access to the directory. This is very easy with IIS. No need to make it harder than it has to.
Re: ExecuteCommand to run a batch file to open a program
Posted: Mon Nov 23, 2015 10:58 pm
by tez
Hi Tomok
Yes, I understand that

As I mentioned, the (2) users are connecting to this vm (TM1) server via RDP & just using TM1Web. They don't have a client installation on their local machine, nor are they using TM1Web on their machine.
Cheers
Terri
Re: ExecuteCommand to run a batch file to open a program
Posted: Mon Nov 23, 2015 11:08 pm
by tez
Hi lotsaram
Thanks for your suggestion, but I had tried the hyperlink in the websheet menu & I get a "reference not valid" error. The URL link is correct as it works when I click on it in Perspectives so this isn't the issue. I'll try your suggestion of storing the URL in a cube...I haven't heard of the virtual website directory or the anon I_Usr account before. Do I need to create this user account on the Windows server &/or Cognos Express?
I was just using the subnm to the calendar dim for the user to easily select the week ending date, to save me creating a data validation range in excel. The users want the ability to access everything from this menu, hence me trying to somehow incorporate it.
Many thanks
Terri