cancel
Showing results for 
Search instead for 
Did you mean: 

Executing vb script from Data Services

Former Member
0 Kudos

I have a vb script that can be executed (from cmd or double clicking the file) on the bods server with no problem. I want BODS to execute the same vb script. So I have tried this 3 different ways of executing.

exec('cscript', '\\\uksvpmc003\\keyrus\\data\\cer_vbs\\test1.vbs',0);

exec('cmd', '\\\uksvpmc003\\keyrus\\data\\cer_vbs\\test1.vbs',0);

exec('cmd', 'cscript \\\uksvpmc003\\keyrus\\data\\cer_vbs\\test1.vbs',0);

I have also tried the above but using the local drive of the server rahter than fully qualufying it ie.e

exec('cscript', ' G:\\Keyrus\\DATA\\CER_VBS\\test1.vbs',0);

exec('cmd', ' G:\\Keyrus\\DATA\\CER_VBS\\test1.vbs',0);

exec('cmd', ' G:\\Keyrus\\DATA\\CER_VBS\\test1.vbs',0);

None of these execute the vb script I get no error messages though. I read this post (hence some of my attempts above) and can't see I have missed anything:

http://scn.sap.com/thread/3193998

Help appreciated.

Accepted Solutions (0)

Answers (4)

Answers (4)

0 Kudos

Don't Laugh Pls .

I know I am very late but I think it has nothing to do with the permission access. If it is, it would throw an error . This is because U have added an extra '/' before script name (name will be preceded by only one '/')  "test1.vbs".

exec('cscript', '\\\uksvpmc003\\keyrus\\data\\cer_vbs\test1.vbs',0);

This must work.

Former Member
0 Kudos

Hi,

     It would be good if you can call the vb script in a .bat file and call the .bat file by using the data service or a scheduling tool.You can give in a script  a call function specifying the path of the .vbs script an save it as a .bat file.that would do.

Former Member
0 Kudos

Hello

I suspect this is permissions related.  The execution is being done as the user that was configured to run the Data Services' service, would this user have permissions to execute the commands?

When you log on to the server and successfully run the command, are you using the same user as Data Services?

Always use UNCs, because mapped drives are generally not visible to services.

To see potentially helpful error messages, wrap the called to exec with a print statement - print(exec(blah,.

Michael

Former Member
0 Kudos

I think you are on to something Michael. I had figured out the enclosing in print function and could see the info about windows script host 5.8 - this showed me that the the script hosting is doing something at least as a result of running the data services job.

Not sure on users (I don't have access myself to the cmd prompt of bods server) but suspect that it is not the same user.

Will feedback when colleagues return from Christmas break!

Former Member
0 Kudos

As an aside, any commands that you want to run from the command prompt on the job server can be executed using the exec function (invoke the command interpreter and pass in your command).  Wrap the exec with the print function and you can do most things, as long as the Data Services service user has permissions, you as a Data Services developer have the ability to run the commands.

If I were you I would try to exec a dir on the directory containing the target VB script, to check if it is visible to the the Data Services processes.

Michael

former_member198401
Active Contributor
0 Kudos

You are right Michael!! This is purely permissions issue on the Data Services job server.

Dan, As a best practice you can copy or move the VB script file(using COPY or MOVE commands in the batch file) from the network drive to the local drive of your DS Job Server. By this you can also keep a track of the script files which were executed on the server.

In this way you don't have to worry about the permissions on the network drive.

Michael , please correct me if am missing something

Cheers!!

Arun

Former Member
0 Kudos

Hello Arun

I'm sorry, but I do not agree with your proposal.  It certainly isn't 'best practice' to move content to the job server, and it isn't for us to prescribe where content is located.

Personally, I would get a domain account created for Data Services, and run the Data Services' service with this account.  The account can then be be granted access to resources (DBs, files, shares, etc.).

Consider a cluster of job servers, each job server would use the same domain account, and hence each would have access the the same resources.  Shared content, like this VB script, can then be accessed by each job server from the same location.

Michael

former_member198401
Active Contributor
0 Kudos

Hi Dan,

Is the issue with the VB script resolved...

Cheers

Arun

vnovozhilov
Employee
Employee
0 Kudos

Try exec('cmd', ' cscript G:\\Keyrus\\DATA\\CER_VBS\\test1.vbs',0);

Thank you,

Viacheslav.

former_member198401
Active Contributor
0 Kudos

Hi Dan,

Could you please try the below command


$G_PROCESSED_LOCATION ='\\\XYZ_Location\ Processed';

exec('cscript','[$G_PROCESSED_LOCATION]\test.vbs', 8);


This should work


Regards

Arun Sasi


Former Member
0 Kudos

No this still does not work I'm afraid......

Former Member
0 Kudos

I don't see why using a variable instead of hard coding the file path would make a difference? I have already tried what you suggest but hard coded the file path:

exec('cscript', '\\\uksvpmc003\\keyrus\\data\\CER_VBS\\test1.vbs',8);

exec('cmd', 'cscript G:\\Keyrus\\DATA\\CER_VBS\\test1.vbs',8);

Neither one works.