Jump to content

This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.

Uninstall MSI with .bat script

1 reply to this topic


  • Full Members
  • 1 posts

Posted 04 November 2015 - 17:19

Hi all,


Apologies if I'm posted this in the wrong place; first-time poster!  I'm not massively experienced with MSI's at all, so hope someone can give me an easy answer.


I've pushed out some software to our client PCs that I'd now like to remove; there is a .bat file that runs on user login that installs the software (basically just a service that gets created):


MSIexec /i "\\<servername>\<msiname.msi>" /q


This works fine.


I've tried creating an equally simple script to uninstall the MSI, but whatever I do, whatever switches I use, it will not do anything unless I get rid of the /q switch - which isn't ideal/helpful/useful - as I don't want users to suddenly start worrying about things popping up when they log in!


PLEASE can anyone advise on the simplest way to get this uninstalled by using a .bat file in the same way as I used to INSTALL the MSI?  Help would be greatly appreciated!


Many thanks,




  • Full Members
  • 35 posts

Posted 06 November 2015 - 21:34

Hi J,


There are a few things that might be happening here and different ways to get what you want done.


First of all, did the MSI you created install per-user for every user that would log into a particular system, or per-machine (but triggered by the first user to log in)?  Do multiple users on the system have a copy installed at the same time?


In theory, the command line you would want in the removal script would be


msiexec /x {productcode} /qn


Using the product code will make things easier and avoid an unnecessary trip to the network drive.


With the above command line, if the product is installed per-user, then each user that logs into a particular system will have their instance of the product uninstalled silently.  If it's per-machine, then each user login after the first will have a failure, so be sure to have your script handle that situation.  (This assumes also that all users would have sufficient privileges to install/uninstall per-machine products.)


In both cases, you'll also want to condition for the same user logging in the second (and subsequent) times.


Hope this helps you in your task.