Page 1 of 1

Need help with ExecuteCommand. Not working for me

Posted: Mon Apr 10, 2017 9:31 am
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);

Re: Need help with ExecuteCommand. Not working for me

Posted: Mon Apr 10, 2017 9:34 am
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)

Re: Need help with ExecuteCommand. Not working for me

Posted: Mon Apr 10, 2017 9:36 am
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.

Re: Need help with ExecuteCommand. Not working for me

Posted: Mon Apr 10, 2017 10:28 am
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.

Re: Need help with ExecuteCommand. Not working for me

Posted: Sat Apr 15, 2017 2:40 pm
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?

Re: Need help with ExecuteCommand. Not working for me

Posted: Sat Apr 15, 2017 8:49 pm
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 ?

Re: Need help with ExecuteCommand. Not working for me

Posted: Mon Apr 17, 2017 2:36 am
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.

Re: Need help with ExecuteCommand. Not working for me

Posted: Mon Apr 17, 2017 2:37 am
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.

Re: Need help with ExecuteCommand. Not working for me

Posted: Tue Apr 18, 2017 12:23 pm
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!

Re: Need help with ExecuteCommand. Not working for me

Posted: Thu Apr 27, 2017 6:42 am
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.

Re: Need help with ExecuteCommand. Not working for me

Posted: Wed Mar 13, 2019 2:15 am
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"