cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
lostboyz
Level 4

Execute batch file during installation and uninstallation

Hi,

I have 2 batch files. One should be executed as a last step of Installation process and another as first step of Uninstallation process. I got to know about the custom actions, but please let me know the sequence of actions and the place where my 2 batch files should be called.

The batch files starts and stops some windows services. I have a batch file as there are many services(11 services).
Labels (1)
0 Kudos
(4) Replies
RobertDickau
Flexera Alumni

First, is it an option to use the built-in Windows Installer service functionality? (You mention custom actions, so I assume this is an MSI project...) That way you don't have to worry as much about permissions, rollback, and all that kind of thing.

Otherwise, batch files that make system changes should be scheduled for "deferred execution", somewhere between InstallInitialize and InstallFinalize. To detect a first-time installation, you can use the condition Not Installed; to detect complete uninstallation, you can use REMOVE="ALL" anywhere after InstallValidate.
0 Kudos
lostboyz
Level 4

Thanks robert, I could call my batch file during installation. but i'm not able to call another batch file during uninstall process.
These batch files are part of my installer. I remove them during uninstall. let me know the sequence where i should call this batch file.
0 Kudos
clintontull
Level 3

Hey Lost.
I have a few of these things as well going on in some of my installs, like using a vb script to create a desktop icon that points to a network location off of the system. Seems the msi cant validate network mappings as the system account. (duh) So. then i had to create a batch file to delete the desktop icon on uninstall. First do you know the syntax for the batch file in the CA if not i can get that for you from some of my projects. (not off top of head and at home bored reading these forums.) Ya Geeky! So if thats the case if you want it to run at uninstall i dont think this needs to be deferred but on install yes it must be run deferred.
Will edit tomorrow...
syntax systemfolder cmd.exe
/c [INSTALLDIR]batchfile.bat.cmd

If memory serves me.
If you have other systems with different drive mappings like our term servers use t.
put a condition on it for terminal servers and not tsremoteadmin i think. i can get these for you to.
set one up for c:\ t:\ etc and put conditions on the CA's
0 Kudos
Sketchy
Level 3

If you're installing, run after InstallFiles in deferred mode. If uninstalling, before RemoveFiles.
0 Kudos