george7a
13th April 2007, 11:59
Hi All,

I have been trying to execute bic_info on a Windows server for a long time but it didn't work if I wasn't on the server itself. So I have found a solution that will "trick" the windows server and execute bic_info without the famous shared memory error.

Here is how I have done it:

Create 2 Batch files and save them under the server (I have saved them under c:\george. My $BSE = E:\baan):

The first batch file is bic2.bat

E:\baan\bin\bic_info.exe {YOUR_DLL_NAME} > c:\george\DLL.txt 2> c:\george\DLL.err

The second (& main) batch is Mybic.bat and here is the code:

call E:\baan\bin\fillenv.bat
call C:\george\bic2.bat

If you try to double click Mybic.bat via remote desktop it will not work! But (and here comes the tricky part) if you scheduled a task (using the windows scheduling tasks program) on the server itself to run mybic.bat it will work! All you have to do then is to go to the scheduler via remote desktop, execute our task & you will get your result in a text file.

The other way to execute Mybic.bat is using a simple Baan script:

long run.id
run.id=run.prog("c:\george\mybic.bat","",RP_WAIT)
if run.id<> 0 then
message("Could not run the batch file. Error number:" & str$(run.id))
endif

I hope you find this helpful,

- George

george7a
13th April 2007, 15:54
With some simple addition we can make this solution more generic:

I have updated the batch files with the following

bic2.bat:

E:\ln6.1\bin\bic_info.exe %1 >c:\george\%1.txt 2> c:\george\%1.err

Mybic.bat:

call E:\ln6.1\bin\fillenv.bat
call C:\george\bic2.bat %1

Now we can call any DLL from our Baan script as in the following example:

long run.id
run.id=run.prog("c:\george\mybic.bat MyDLLName","",RP_WAIT)
| MyDLLName is a variable (or a extern field in a session)
if run.id<> 0 then
message("Could not run the batch file. Error number:" & str$(run.id))
endif
| You can copy the result txt file to the local and view it too!

- George

george7a
13th April 2007, 16:07
The last (updated) batch files can be also executed (on the server) from the client using PsExec (http://www.microsoft.com/technet/sysinternals/utilities/psexec.mspx).

I have wrote another batch file that will activate psexec. I have called it client_bic_info.bat:

d:\bic\psexec.exe \\BaanServ -u baan -p **** c:\george\mybic.bat %1

Now we can run bic_infro from the client on any DLL we want. This is an example of how to use the client_bic_info.bat:

d:\bic\client_bic_info.bat ottdllbw

The result will be found under the server. We can simply change the result's path to any shared directory.

- George