ExeciteCommand not running vbscript

Post Reply
kc_132
Posts: 6
Joined: Thu Aug 02, 2012 1:29 am
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2010

ExeciteCommand not running vbscript

Post 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.
BigG
Community Contributor
Posts: 211
Joined: Tue Sep 15, 2009 11:13 pm
OLAP Product: IBMPA
Version: PA 2.0 Cloud
Excel Version: 2010

Re: ExeciteCommand not running vbscript

Post 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);
GG
kc_132
Posts: 6
Joined: Thu Aug 02, 2012 1:29 am
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2010

Re: ExeciteCommand not running vbscript

Post 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?
BigG
Community Contributor
Posts: 211
Joined: Tue Sep 15, 2009 11:13 pm
OLAP Product: IBMPA
Version: PA 2.0 Cloud
Excel Version: 2010

Re: ExeciteCommand not running vbscript

Post 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 );
GG
kc_132
Posts: 6
Joined: Thu Aug 02, 2012 1:29 am
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2010

Re: ExeciteCommand not running vbscript

Post by kc_132 »

Thanks again.

Tried your code with cscript.exe call....still no change....
BigG
Community Contributor
Posts: 211
Joined: Tue Sep 15, 2009 11:13 pm
OLAP Product: IBMPA
Version: PA 2.0 Cloud
Excel Version: 2010

Re: ExeciteCommand not running vbscript

Post 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
GG
Malcolm MacDonnell
Posts: 26
Joined: Thu May 29, 2008 2:58 am

Re: ExeciteCommand not running vbscript

Post 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
kc_132
Posts: 6
Joined: Thu Aug 02, 2012 1:29 am
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2010

Re: ExeciteCommand not running vbscript

Post 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....
User avatar
Michel Zijlema
Site Admin
Posts: 712
Joined: Wed May 14, 2008 5:22 am
OLAP Product: TM1, PALO
Version: both 2.5 and higher
Excel Version: 2003-2007-2010
Location: Netherlands
Contact:

Re: ExeciteCommand not running vbscript

Post 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
kc_132
Posts: 6
Joined: Thu Aug 02, 2012 1:29 am
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2010

Re: ExeciteCommand not running vbscript

Post 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!
kc_132
Posts: 6
Joined: Thu Aug 02, 2012 1:29 am
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2010

Re: ExeciteCommand not running vbscript

Post 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.
Post Reply