Need help with ExecuteCommand. Not working for me

Post Reply
Ashleigh W
Posts: 88
Joined: Mon Oct 24, 2016 1:21 pm
OLAP Product: TM1
Version: TM1 Perspectives 10
Excel Version: Excel 2016

Need help with ExecuteCommand. Not working for me

Post by Ashleigh W »

Hi TM1 Experts,

Need help again it's been a while. I 'm trying to use ExecuteCommand function to run movefile.vbs file to move some files in server dir to windows drive.
It runs without error but I do not see the output in windows directory. I have manually executed this movefile.vbs file and it works ok.

What am I doing it wrong? Thanks in advance.

Code: Select all

ExecuteCommand('"C:\windows\system32\cscript.exe" "\\boa.tm1.dev\outputs\movefile.vbs"',1);
Edward Stuart
Community Contributor
Posts: 247
Joined: Tue Nov 01, 2011 10:31 am
OLAP Product: TM1
Version: All
Excel Version: All
Location: Manchester
Contact:

Re: Need help with ExecuteCommand. Not working for me

Post by Edward Stuart »

What account runs the TM1 Server? Does this account have security privileges to perform the actions in the script? (i.e. move files into the windows drive)
Ashleigh W
Posts: 88
Joined: Mon Oct 24, 2016 1:21 pm
OLAP Product: TM1
Version: TM1 Perspectives 10
Excel Version: Excel 2016

Re: Need help with ExecuteCommand. Not working for me

Post by Ashleigh W »

Hi Edward, not sure but I do have admin access I am a developer. Is there a way to check this? I log on to the environment using my windows credentials.
tomok
MVP
Posts: 2831
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Need help with ExecuteCommand. Not working for me

Post by tomok »

Ashleigh W wrote:Hi Edward, not sure
Well then you need to find out. TM1RunTI.exe runs under the account the TM1 server runs on not yours. If that account does not have security access to the folder(s) in question then it will fail silently.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
yingchai
Posts: 43
Joined: Wed Nov 19, 2014 6:36 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2013

Re: Need help with ExecuteCommand. Not working for me

Post by yingchai »

I also have a similar problem here.
My vbs script function: converts a .xlsm file into .txt file and place the .txt file into a separate folder.

If I manually execute this .vbs script, it works okay.

If I trigger this .vbs script from a TI, the process failed. After investigating the TI process log file, it shows this error:
Error: Epilog procedure line (12): Access is denied.
The error is referring to this TI code:

Code: Select all

ExecuteCommand('"C:\windows\system32\cscript.exe" "\\server\scripts\convert.vbs"',1);
How can we troubleshoot this problem?
Wim Gielis
MVP
Posts: 3105
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Need help with ExecuteCommand. Not working for me

Post by Wim Gielis »

yingchai wrote:If I manually execute this .vbs script, it works okay.

If I trigger this .vbs script from a TI, the process failed
What user accounts are involved (your account and the one under which the TM1 service runs) and in what way do they differ ?
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
yingchai
Posts: 43
Joined: Wed Nov 19, 2014 6:36 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2013

Re: Need help with ExecuteCommand. Not working for me

Post by yingchai »

Wim Gielis wrote:
yingchai wrote:If I manually execute this .vbs script, it works okay.

If I trigger this .vbs script from a TI, the process failed
What user accounts are involved (your account and the one under which the TM1 service runs) and in what way do they differ ?
I am running the TI process from the server itself.

The TM1 service is runing from a domain account with Admin rights.

During the TI execution from server, I am logging in to server using a local Admin account.
yingchai
Posts: 43
Joined: Wed Nov 19, 2014 6:36 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2013

Re: Need help with ExecuteCommand. Not working for me

Post by yingchai »

Ashleigh W wrote:Hi TM1 Experts,

Need help again it's been a while. I 'm trying to use ExecuteCommand function to run movefile.vbs file to move some files in server dir to windows drive.
It runs without error but I do not see the output in windows directory. I have manually executed this movefile.vbs file and it works ok.

What am I doing it wrong? Thanks in advance.

Code: Select all

ExecuteCommand('"C:\windows\system32\cscript.exe" "\\boa.tm1.dev\outputs\movefile.vbs"',1);
Hi Ashleigh,

It would be helpful if you can share the error details from the TI process log.
User avatar
PavoGa
MVP
Posts: 616
Joined: Thu Apr 18, 2013 6:59 pm
OLAP Product: TM1
Version: 10.2.2 FP7, PA2.0.9.1
Excel Version: 2013 PAW
Location: Charleston, Tennessee

Re: Need help with ExecuteCommand. Not working for me

Post by PavoGa »

How can we troubleshoot this problem?
I think you have almost completely done that, but here is a final test:

Login in AS the tm1service account on the server and execute the script from the command prompt. I believe you'll find the service account does not have access to the required file. I see this particularly when we have separate domains for DEV/QA/PROD and trying to write to a DEV file server for diagnostics only to discover the QA or PROD service account does not have rights in the target environment. May not be your case, just an example.

On one project, we had serious issues with a script running (it was an email script) and after letting all the various departments argue about for three or four weeks, I put everyone who could possibly be involved in a room. Took about 15 minutes to find out the service account was missing a required access right.

Good luck!
Ty
Cleveland, TN
yingchai
Posts: 43
Joined: Wed Nov 19, 2014 6:36 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2013

Re: Need help with ExecuteCommand. Not working for me

Post by yingchai »

Sometimes, after we had checked and applied the security access in Windows level, a server reboot is required for the settings to take effect.
cjshown
Posts: 3
Joined: Tue Nov 03, 2015 10:48 pm
OLAP Product: IBM Cognos TM1
Version: 10.2.2
Excel Version: 2013

Re: Need help with ExecuteCommand. Not working for me

Post by cjshown »

Just a reminder to not skip the obvious stuff (because I just did): make sure your batch script uses the full path to any executable/vbs script etc. that you call. All my tests were working from the command line (as myself, as the TM1 Service account, etc.) - but I was testing after already changing into the directory where the batch file was, which was were my executable was as well. After finally testing the command in another directory did I realize the mistake. :roll:

example
was this and failed:
START executable.exe "E:\path_to_file\file.txt"

changed to this and worked:
E:
cd "E:\path_to_executable"
START executable.exe "E:\path_to_file\file.txt"
Post Reply