Tip: How to run an MSI uninstallation
from script
On this page
we explained how to run an MSI installation during Visual
Installer's setup process. You may wonder if it is possible to
uninstall these files during Visual Installer's uninstallation
process, and the answer is: yes, it is possible.
There is another script command available that functions like
MSIEXEC
but it is run during an uninstallation process instead. The name
of the command is
UNINSTALL_MSIEXEC
and it takes the same three parameters as
MSIEXEC:
UNINSTALL_MSIEXEC %Filename, %Param, %Wait |
|
|
%Filename |
Complete
path to the MSI file, for example
%DESTDIR\MySetup.msi. |
%Param |
Command line
parameters to send to Windows Installer. Optional. |
%Wait |
Wait until
the MSI installation is completed, or not. Optional. |
The %Filename parameter must always be specified and must
contain a full path to an MSI file.
The %Param
parameter must contain all command line parameters (switches)
that you want to pass to Windows Installer. The use of %Param
is optional, but if you want to make an uninstallation the
parameter must contain at least the /x switch. The /x
switch tells Windows Installer to make an uninstallation. The
%Param
parameter can also contain another command line
switches, like /qn (silent installation), so if you need
to use more than one switch you can separate them with a space
(e.g.: "/qn /x").
A complete list with possible parameters is available on
this Microsoft page.
The
%Wait parameters is also optional. To get more information
about the
%Wait parameter and its use, you can read
the page with
the
MSIEXEC
tip.
Examples of usage -
UNINSTALL_MSIEXEC: |
The example below shows how to use
MSIEXEC
to install files during Visual Installer's installation process
and how to use
UNINSTALL_MSIEXEC
to uninstall same files during Visual Installer's uninstallation
process.
// Run this MSI installation during Visual Installer's
installation process
MSIEXEC
%DESTDIR\MySetup.msi, /qn
// Run this MSI uninstallation during
Visual Installer's uninstallation process
UNINSTALL_MSIEXEC
%DESTDIR\MySetup.msi, /qn /x
|
By passing the /x switch to Windows Installer (via
UNINSTALL_MSIEXEC)
we inform Windows Installer that we want to make an
uninstallation. By passing the /qn switch we inform
Windows Installer that we want to make a silent installation and
uninstallation. The command lines above should be entered in the
After installation tab in the script window:
|
< Go back (to the
MSIEXEC tip)
|
|
Visual
Installer Tip |
|
Only Professional
Version |
|