views:

17614

answers:

7

msiexec is a command prompt software that installs an msi program.

But I have found that you can install an msi file from the command line by just typing in the name of the msi file on the command line.

But in order to uninstall the msi file, it seems you have to call the msiexec program and give it an /x or /uninstall.

Does anyone know how I can uninstall and msi from the command line without using the msiexec routine?

+2  A: 

The msi file extension is mapped to msiexec (same way typing a .txt filename on a command prompt launches notepad/default txt file handler to display the file).

Thus typing in a filename with msi extension really runs msiexec with the msi file as argument and takes the default action, install. For that reason, uninstalling requires you to invoke msiexec with uninstall switch to unstall it.

Tuminoid
A: 

I'm assuming that when you type int file.msi into the command line, Windows is automatically calling msiexec file.msi for you. I'm assuming this because when you type in picture.png it brings up the default picture viewer.

smack0007
+9  A: 

Short answer: you can't. Use MSIEXEC /x

Long answer: When you run the MSI file directly at the command line, all that's happening is that it runs MSIEXEC for you. This association is stored in the registry. You can see a list of associations by (in Windows Explorer) going to Tools / Folder Options / File Types.

For example, you can run a .DOC file from the command line, and WordPad or WinWord will open it for you.

If you look in the registry under HKEY_CLASSES_ROOT\.msi, you'll see that .MSI files are associated with the ProgID "Msi.Package". If you look in HKEY_CLASSES_ROOT\Msi.Package\shell\Open\command, you'll see the command line that Windows actually uses when you "run" a .MSI file.

Roger Lipscombe
You actually could by replacing the command in the registry to also contain the option /x. But I'm sure no one wants to do that because if you do you can no longer install an msi by double-clicking on it.
0xA3
A: 

OK, so how do I do an uninstall of an msi file/installation using MSIEXEC from a command line?.

Now, I have tried just about everythign to make this happen

All the options failed and popped up a little window showing the proper syntax for using MSIEXEC and I thought I was using it correctly.

I tried the following it failed:

msiexec /quiet /uninstall /package filename.msi

xarzu
Because /package is the same as /i, meaning install, and because /uninstall (the same as /x) means uninstall? Use the short form, anyway: msiexec /x foo.msi /qn
Roger Lipscombe
A: 

I would try the following syntax - it works for me

msiexec /x filename.msi /q

HTH

+8  A: 

There are a few ways to uninstall an MSI package.


  • If you have access to the original MSI used for the installation, you can simply right click it in Windows Explorer and select Uninstall.
  • As stated above you can do the same by command line: msiexec /x filename.msi /q


  • Just got to mention the normal approach though it is obvious
  • Go start -> run -> appwiz.cpl -> ENTER in order to open the add/remove programs applet (or click add/ remove programs in the control panel)
  • Click "Remove" for the product you want to uninstall.


  • You can locate the required code to pass to msiexec.exe /x by opending regedit.exe at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall and search for the application name (or just browse through each sub folder till u find it).
  • When you have found it you can pass it to msiexec as explained above: msiexec.exe /x {0077A7C7-3333-2222-1111-111111111000}


  • MSI strips out all cabs and caches each MSI installed in a super hidden system folder at %SystemRoot%\Installer (you need to show hidden files to see it).
  • All the MSI files here will have a random name assigned, but you can get information about each MSI by showing the Windows Explorer status bar (View -> Status Bar) and then selecting an MSI. The summary stream from the MSI will be visible at the bottom of the Windows Explorer window.
  • Once you find the right MSI, just right click it and go Uninstall.


  • Finally you can uninstall an MSI via the Windows Installer Automation api

    Const msiUILevelNone = 2

    Set objInstaller = CreateObject("WindowsInstaller.Installer") objInstaller.UILevel = msiUILevelNone objInstaller.InstallProduct( "product.msi", "REMOVE=ALL") Set objInstaller = Nothing

Glytzhkof
+6  A: 

Also remember that an uninstall can be initiated using the WMIC command:

wmic product get name --> This will list the names of all installed apps

wmic product where name='myappsname' call uninstall --> this will uninstall the app.

themrnutz