Client Management Suite

 View Only

UNinstalling an MSI Without VBscript 

Apr 15, 2008 01:42 PM

You've probably come across times when you need to deploy an application, but before you can install it, you need to make sure another application is uninstalled. Maybe the other application is a previous version of the new application or just something that isn't compatible with the new application. Or maybe you just need to remove an application from a system without installing anything new. I put together this steps to handle these situations and have used it many times.

Creating a Batch File

Here the Action of a Batch file is to Uninstall an Application through product code.

We can change this command line according to our requirements.

  1. Open notepad.
    msiexec.exe /x{00000000-0000-0000-0000-000000000000} /qb!
    
    
  2. Copy the above code in it.
  3. Save the file as "UNinstall.BAT"

Call this batch file through a custom action.

Create a Custom Action for the UNINSTALLATION

  1. Click the MSI Script tab, then click the Execute Immediate tab.
  2. Scroll down to the Cost Finalize script line in the Installation Sequence pane. It's the last line in the fifth section of script.
  3. Select the blank line below the Cost Finalize action then double-click the Execute program from Destination action in the Actions pane. The Execute program from Destination dialog appears.
  4. Fill in the fields as follows: Custom Action Name: Enter a name for this custom action. Executable File : Enter the path Command line Arguments: "[SystemFolder]cmd.exe" /c "[INSTALLDIR]UNinstall.bat"
  5. Leave the Property Settings field blank.
  6. Click OK.
  7. Save the Custom Action.

Statistics
0 Favorited
3 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Comments

Jun 06, 2009 03:31 AM

Hi,

Even the custom action has been added under "Execute Immediate", can anyone tell me the point of invocation. (Button click, navigation etc). Or will it be a sequencial execution?

Please help me in this. Thanks in advance.

Apr 25, 2008 03:29 AM

Yes! sajji "u can do it.for downgrading"
try it
Cheers Tillu

Apr 24, 2008 03:48 AM

Hi, Is it possible to uninstall higher version while installing lower version "Downgrading" by upgrade tab,
Pls give details for uninstalling higher version by custom action, also where i have to keep the custom action (Execute Immediate?),Condition?Properties?keypath?.. , pls give the details,
Thanks in advance

Apr 23, 2008 11:15 AM

I second this thought.. When we have ready solutions, why use a custom written script? hat was why I was figuring out the possible ways of using this in my post.

Apr 23, 2008 07:40 AM

One would ask why would you even bother to do this.
Windows Installer already has its own tables to handle uninstallation of another application. Why create a custom solution for functionality that is built in natively.
have a look at the upgrade table..

Apr 22, 2008 10:38 AM

Actually , whole stuff is Composed for an idea or Awareness using a batchfile for UNinstalling an MSI
Please go with your requirements and set that custom action under proper conditions...
Andmore Over before doing all this stuff , Place the UNinstall.bat file must be in the Application data and set keypath for it..ok
Cheers Tillu

Apr 22, 2008 07:45 AM

Would like to understand how order of transforms are important while uninstallation.
Agree order of MST is vital for installation command.My understanding is uninstallation depend on product. Hence MST order do not play any role while uninstallation. MSI+MST1+MST2+....+MSTn is whole product represeneted by Product code. Hence MSIEXEC /X {Prduct code} will help to uninstall.
Cheers
Harsh

Apr 22, 2008 02:52 AM

Hi Im new to Application packaging,
Im not understanding one side u will sugest to add under "Cost Finalize" and in last Picture the custom action line came below "Install Finalize" in "Execute Immediate". One more thing, we have to add that batch file to any folder of application and then we have to give the PATH: for working directory of custom action? Pls help me,I have to uninstall one application before installing new (MSI)application.
Thanks in advance....

Apr 21, 2008 10:28 PM

One point which isn't clear is that, when do we need to use this practice? I reckon that, this scripted MSI can be used only to remove a product from the machine. It cannot be in-corporated into the package for doing multiple operations.
I remember that sometime back in our project, we were asked to create a package which just un-installs an application from the machine. We had to analyze many factors like User SID etc.. for the same.
Again, this script will work only if the application is installed per machine, This cannot be used for a per-user installation.
Cheers'
Vijay

Apr 21, 2008 02:45 PM

In our case, we usually use Vbscript even if it's a simple msi uninstall.
The reason being is to have consistency across all of our SWD packages and tasks.
Even if the script is only executing one uninstall line, it's nice to have the package already wrapped in a vbscript in case we need to make quick changes later.
If the change is too involved, then yes, we would create a transform, but a lot of times creating an MST is just overkill and a batch script isn't flexible enough.

Apr 18, 2008 03:37 AM

Many times it is not neccessary to install or uninstall any application with .bat file or with vbscrit,
but there are some situations where an end user can not install or uninstall properly,
Installing or uninstalling an application with multiple .mst (TRANSFORMS) can be done through .bat because while installing the application need to be in an order (msiexec /i path.msi TRANSFORMS=transform1.mst;transform2.mst)while uninstalling the multiple .mst (TRANSFORMS) the sequence of order need to be reversed (msiexec /x path.msi TRANSFORMS=transform2.mst;transform1.mst).
In such kind of Scenario we can use .bat file
Call this batch file through a custom action.
Prasanna Kumar Raja
Sr.Application Packager
Anovatek

Apr 15, 2008 02:16 PM

Good catch GoBlue47,
I've removed that classification from the article.
JM

Apr 15, 2008 02:07 PM

not sure how this applies to Application Metering Solution....

Related Entries and Links

No Related Resource entered.