Page 1 of 1

ExeciteCommand not running vbscript

Posted: Thu Aug 02, 2012 1:47 am
by kc_132
Hi all,

Quick dillema, I am running a vbscript off a TM1(9.5) TI process using execute command.

sEmail = 'mail@mail.com';
sSubject = 'Test';
sSendParameter = ' "' | sEmail | '" "' | sSubject | '"';
S_Run='cmd D:\Cognos\TM1\Production\Production Data\SendMailValidationLogsOriginal.vbs' | sSendParameter;
ExecuteCommand(S_Run,0);

The .vbs files creates an excel file, saves it and attaches it to an email and sends it.
1. The .vbs works fine when run in command prompt under my user account.
2. The .vbs works fine when run in command prompt under the network account used to run the TM1 service.
3. The .vbs script does not execute when run via ExecuteCommand within the TI process.
Also, if I comment out the line in the vbscript where it tries to save the excel file the above TI works fine. When the save as line is active TI does not work. So it has to be an account permissions issue but -
A previous post was solved suggesting it was a permissions issue with the account associated with the TM1 service, however as per point no. 2 above this has been checked.
I have also tried cmd /c in the TI if it makes a difference, put in pause loops to wait etc. no luck.

Any ideas?

Thanks.

Re: ExeciteCommand not running vbscript

Posted: Thu Aug 02, 2012 2:02 am
by BigG

Code: Select all

# Wait = 1 will wait for vbs to complete, while 0 will not
vWait = 0;

# Location of command-based script host
vCScript = 'C:\windows\system32\cscript.exe';

sEmail = 'mail@mail.com';
sSubject = 'Test';
sSendParameter = ' "' | sEmail | '" "' | sSubject | '"';
S_Run='cmd D:\Cognos\TM1\Production\Production Data\SendMailValidationLogsOriginal.vbs' | sSendParameter;
ExecuteCommand(S_Run,vWait);

Re: ExeciteCommand not running vbscript

Posted: Thu Aug 02, 2012 2:09 am
by kc_132
Thanks BigG,

Already tried with wait parameter set to 1.

This seems to hang the process because it waits infinitely for a complete flag from command prompt which never returns.
I have read of this issue in other forums as well.

Any thoughts?

Re: ExeciteCommand not running vbscript

Posted: Thu Aug 02, 2012 2:52 am
by BigG
Unsure on the reason why, but do you call calling from cscript.exe

Code: Select all

# 

sEmail = 'mail@mail.com';
sSubject = 'Test';
sSendParameter = ' "' | sEmail | '" "' | sSubject | '"';

Wait = 1 will wait for vbs to complete, while 0 will not
vWait = 0;

# Location of command-based script host
vCScript = 'C:\windows\system32\cscript.exe';

# Obtain path 
vPathSource = 'D:\Cognos\TM1\Production\Production Data\;

# Name of script file
vVBScript = 'SendMailValidationLogsOriginal.vbs' ;

# Execute vbs by calling from cscript.exe
ExecuteCommand( vCScript | ' "' | vPathSource | vVBScript | sSendParameter| '"', vWait );

Re: ExeciteCommand not running vbscript

Posted: Thu Aug 02, 2012 3:08 am
by kc_132
Thanks again.

Tried your code with cscript.exe call....still no change....

Re: ExeciteCommand not running vbscript

Posted: Thu Aug 02, 2012 3:30 am
by BigG
Does sound like a permission issue arund TM1 service account, but cant really add anything, hopefully someone else picks this up... sorry I cant help

Re: ExeciteCommand not running vbscript

Posted: Thu Aug 02, 2012 3:50 am
by Malcolm MacDonnell
Hi KC,

when I'm running vbscripts I always use something like:

s_Run = 'cmd /C wscript "D:\Cognos\TM1\Production\Production Data\SendMailValidationLogsOriginal.vbs"' | sSendParameter;

The /C terminates the commandshell afterwards, and there's a pair of double quotes as you have a space in your string

Hope this helps
Mal

Re: ExeciteCommand not running vbscript

Posted: Thu Aug 02, 2012 4:11 am
by kc_132
Thanks for the reply Mal,

Tried your method and copied your code, agree with everything you say but still seems to be a no go......

Just came accross another element -
Interestingly, I just discovered that although it works when I call my vbscript directly from the command prompt, however.......

The following was tested from command prompt -
1. When I call SendMailValidationLogsOriginal.vbs via another script file i.e test.vbs => SendMailValidationOriginal.vbs - it does not work.

2. When I call SendMailValidationLogsOriginal.vbs via another script file with the save as line commented i.e test.vbs => SendMailValidationOriginal.vbs - it works

This may be outside the realm of TM1, but it appears when a vbscript is called indirectly(via TI or another .vbs) it does refuses to run any save as or publish lines of code, when called directly it has no problem running every line......

I might post this in a vbscript forum and see what comes of it, but if anyone has any suggestions it may still be related to TM1, or if there are vb gurus here would greatly appreciate your thoughts....

Re: ExeciteCommand not running vbscript

Posted: Thu Aug 02, 2012 5:32 am
by Michel Zijlema
This recently came up - also a problem with executing vbs from TI. Not identical to your situation, but perhaps of help.

Michel

Re: ExeciteCommand not running vbscript

Posted: Thu Aug 02, 2012 6:15 am
by kc_132
Thanks Michel,

Read through and this sounds like my problem exactly. I will try to implement the solution and post back if it works well.

Nice one, thanks!

Re: ExeciteCommand not running vbscript

Posted: Fri Aug 10, 2012 2:50 am
by kc_132
Thanks again Michel,

The solution worked like a charm!

FYI apparently C:\Windows\SysWOW64\config\systemprofile\desktop needed to exist.
Created the folder, restarted the server and everything worked as it should.

For a detailed explanation as to why it works please refer to Michels link above, not sure of the exact technical reasons myself.

Thanks All.