/build/static/layout/Breadcrumb_cap_w.png

Custom action to call a batch file

Hi,

I am trying to write a custom action to cal the batch file.

I have written it but problem is that it only launches the black screen ( command screen ) for a while but doesn't execute the command written in batch file.

command written in batch file is as follow, a single line:

NwSAPSetup.exe /Silent /Pakcage="SAP_GUI_7.10_b01"


When this batch file is executed by double click, it works pefectly but from a msi custom action it is not working.

Please help...[&:]

0 Comments   [ + ] Show comments

Answers (27)

Posted by: cygan 15 years ago
Fifth Degree Brown Belt
0
very simple task but just wondering why do you want to exeucte the .bat file

have a look at https://kb.altiris.com/ type in comspec and look for article id 2505

job done

regarding the vb script with the custom action how is it sequenced and what are your conditions are you using the binary table
Posted by: djain3 15 years ago
Second Degree Blue Belt
0
Hi Cygan,

I did as per article.

I get an error as "There is a problem with this windows installer package. A program run as part of the setup didn't finish as expected."

Am i doing somthing wrong? please advise
Posted by: djain3 15 years ago
Second Degree Blue Belt
0
For vbscript, i am using custom action 50 and sequence immediate execute sequence after install finalize

and I get the same error.[&:]
Posted by: cygan 15 years ago
Fifth Degree Brown Belt
0
as per the error number what is it

I need to first understand the logic behind the batch file
are you running the .bat after the msi installs?
Posted by: cygan 15 years ago
Fifth Degree Brown Belt
0
seems to me you have not included "NwSAPSetup.exe" in your package

where is the ref to the <path> ie C:\foldername\NwSAPSetup.exe in your batch file
have you added the batch file to your package
if you are running NwSAPSetup.exe after the msi installs then sequence after innstallfinalize with condition Not Installed
Posted by: anonymous_9363 15 years ago
Red Belt
0
For vbscript, i am using custom action 50 and sequence immediate execute sequence after install finalize
and I get the same error.
Hardly surprising, since Type 50 wants to run an EXE, not a VBS :)

Refer to your other post for detail on how to proceed with your SAP install.
Posted by: djain3 15 years ago
Second Degree Blue Belt
0
Yes you are correct this NwSAPSetup.exe is not included in msi package.

there is nothing in my msi package...just nothing...I have created a msi wrapper to call this NwSAPSetup.exe as msi installation is required for Landesk deployment...

I just have to install this exe using the msi....thats it

Yes, I run the .bat file after the installfinalize...

.bat file contains a single line which is : NwSAPSetup.exe /Silent /Pakcage="SAP_GUI_7.10_b01"

problem i have is...when this bat file is run..it install SAP 7.10 and a desktop shortcut ... which launch perfectly..


I have used the msi custom action to call this command...first set a property to poing path of this exe and then call another custom actioin to provide /Silent /Pakcage="SAP_GUI_7.10_b01" command.

This also install SAP on target machine. Now the issue is that shortcut doesn't launch.

So, I thought if bat file install it fine then I should call the bat file from my package.

I have used the set property custom action with InstallAction property with value of [SourceDir]setup\NwSAPsetup.exe

and then used the custom action execute program from path where i have passed the following command to installaction property /Silent /Package="SAP_GUI_7.10_b01"
Posted by: cygan 15 years ago
Fifth Degree Brown Belt
0
hi djain3

lets tick some boxes here then we can know where we are

that bat file runs outside the msi and you have verified that it installs

do us a favour created a log file and search for the custom action name and post the error just the lines with the CA
Posted by: cygan 15 years ago
Fifth Degree Brown Belt
0
ok will give you a TIP here hope this might help.
this is by no means a packaging standard for removing folders
will create a folder on programfilesfolder called "myfolder" and I will delete this folder on installing my msi

I will create a folder "c:\program files\myfolder"
will create a .bat file called mybat.bat
mybat.bat contains RD /S /Q "C:\program files\MyFolder" <note path>
add .bat to the msi < note path>

custom action type : execute program from path
property : %COMSPEC
command line : "/c "c\<note path>"\"mybat.bat""
location : Normal Execute Immediate/deferred. After InstallValidate
condition : REMOVE= "ALL"
processing option : synchronous, ignore exit code


in your case sequence after installfinalize with condition Not Installed
if your setup.exe has other files in the folder you will have to include them as well
forget about using properties to define the path for now just hard code it and see if your batch file works
Posted by: djain3 15 years ago
Second Degree Blue Belt
0
Dear cygan,

Thanks for all your suggestion..

Path to my .bat file is [SourceDir]setup\SAP.bat

because I run the bat file within the source directory..I have used the same way you have suggested for custom action...but it fails.. :(
Posted by: djain3 15 years ago
Second Degree Blue Belt
0
I have not included bat file in my msi.

Why do I need to ? please advise...as I simply run bat from soure diretory

is it mandatory to include .bat file in package to work? where should I install it and what is the use when it has to run from source directory
Posted by: cygan 15 years ago
Fifth Degree Brown Belt
0
did you use the option

processing option : synchronous, ignore exit code
Posted by: cygan 15 years ago
Fifth Degree Brown Belt
0
Why do I need to ? please advise...as I simply run bat from soure diretory ORIGINAL: djain3

I have not included bat file in my msi.

Why do I need to ? please advise...as I simply run bat from soure diretory

is it mandatory to include .bat file in package to work? where should I install it and what is the use when it has to run from source directory


seems your bat file is not been read from the soucre dir hence 1722
try the tip that i gave
Posted by: djain3 15 years ago
Second Degree Blue Belt
0
Dear cygan....if I use sychronous ignore exit code...it will not give error for sure but it doesn't mean that it will execute the command given in custom action :) custom action still fails

yes, bat file is not running from souredir....that i wanted to know ...why


I finally got the root of the problem..

My original CA type 50 worked...the problem was that batch file was installing preprequisites (MSXML and VC++ 2005 redist)

and the custom action I used to call the command to call SAP executable was not installing the prerequisites.

So, finally I am getting prerequisites installed separately and SAP separately.

All look ok at the moment.
Posted by: cygan 15 years ago
Fifth Degree Brown Belt
0
all that starts well ends well

cheers
Posted by: anonymous_9363 15 years ago
Red Belt
0
I, too, wondered about your advice to ignore the exit code but figured someone else would pick you up on it. If an MSI is doing is calling an EXE to perform the actual install, I'd want an returned error to be handled rather than ignored!
Posted by: jmcfadyen 15 years ago
5th Degree Black Belt
0
last i checked SAP was already MSI based called by an external EXE wrapper.

As such wrapping your EXE file with an MSI is likely to fail due to this

MSI for landesk calls EXE

EXE calls MSI for SAP

duplicate session existance will cause the EXE to fail deployment as you already have a session in progress from your wrapper.

;-)
Posted by: Blue_Demon 15 years ago
Orange Senior Belt
0
Hey folks,



I have the same issue, need to deploy VC++ 2005 redist before installing an application (or the app install doesn't finish if it isn't present).



Trying to get a custom action going to run the PreReq first, then install the app, but it keeps installing it afterwards and returns an error about having another install running.


Any quick tips?


Thanks.
Posted by: anonymous_9363 15 years ago
Red Belt
0
Forget using a CA. Besides anything else, nested MSIs are actively discouraged (notwithstanding WI v4.5's chained MSI functionality).

Use whatever deployment mechanism you have to install the VCRTs first, then have your Desktop boys include it in the next build!
Posted by: Blue_Demon 15 years ago
Orange Senior Belt
0
Yeah, I'll suggest that. MSI and MST are working perfectly, it just needs this exe run beforehand. They might need to get it out to the users before doing the group memberships for this application (deploying with GPO).




Thanks mate.
Posted by: anonymous_9363 15 years ago
Red Belt
0
(deploying with GPO).That makes it easy, then. You can create a deployment package with the VCRTs and deploy it to 'Authorised Users' on a per-machine basis.
Posted by: Blue_Demon 15 years ago
Orange Senior Belt
0
ORIGINAL: VBScab

(deploying with GPO).That makes it easy, then. You can create a deployment package with the VCRTs and deploy it to 'Authorised Users' on a per-machine basis.



[font="tms rmn"]
Cool. So just do up an MSI running this exe?

How does GPO handle the sequence of installs, as I need the merge module exe to run before the application install. (Coming from a Netware background, so not 100% on GPO)
Posted by: jmcfadyen 15 years ago
5th Degree Black Belt
0
blue your still missing the point here.

you cannot run 2 msi's together.

VC 2005 is an MSI wrapped inside an EXE. Therefore your method of wrapping the exe in an msi will not work.

As your initial msi will run, call the exe which in turn will call the MSI which will clash with your already present msi session.

if you want to deploy VC 2005 with GPO you need to extract the MSI from the EXE and deploy that.
Posted by: Blue_Demon 15 years ago
Orange Senior Belt
0
OK. I get what you're saying now. As it's an EXE, that was what was throwing me. I've tried running uniextract16.exe on the vcredist_sp1_x86.exe file but it cannot extract anything. The install runs through so quickly, I can't grab anything from the %TEMP% folder.


Any other possible way?
Posted by: spartacus 15 years ago
Black Belt
0
ORIGINAL: Blue_Demon

OK. I get what you're saying now. As it's an EXE, that was what was throwing me. I've tried running uniextract16.exe on the vcredist_sp1_x86.exe file but it cannot extract anything. The install runs through so quickly, I can't grab anything from the %TEMP% folder.


Any other possible way?






Try opening vcredist_sp1_x86.exe in WinZip. This should allow you to extract the file VCREDI~3.EXE. Then open the extracted VCREDI~3.EXE in WinZip and you should see the MSI and CAB files vcredist.msi and vcredis1.cab respectively.

Regards,

Spartacus
Posted by: anonymous_9363 15 years ago
Red Belt
0
[font="tms rmn"]How does GPO handle the sequence of installs, Add the MSI (and don't forget the MST - use the 'Modifications' tab) to the GPO in the order in which they should be installed. Better yet, why not create a machine-based GPO for the VCRTs and assign it to 'Authorised Users'? That way, machines get the machine deployment before users log in.Oops! I already said that...
Posted by: Blue_Demon 15 years ago
Orange Senior Belt
0
Guys, thanks for the help on this.

Got Univeral Extractor to extract the MSI and CAB file (no idea why it didn't work the other day). Have depolyed this pre-req and then followed up with the application install.


Works a treat on a machine install, is giving an error on a file as a user install, but I'll google the issue and work it out.


Unfortunately, this client doesn't have a conflict management database, or any other conflict management tools/procedures, so I think we might have some issues in pilot. Have to see how this one works out.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ