We have a msi package which installs a Windows Service. At end-of-day, the windows service downloads a new msi package from a public blob location and kick off reinstalls.
The reinstall command =
msiexec /i GatewayService.msi /qn REINSTALL=ALL REINSTALLMODE=vamus /L*V msi.log
What we want is as follows:
This should reinstall the whole msi package again w/o any check on
any conditions
Whatever files are in the new msi should be copied to installed dir and files not in the new msi should be trashed.
So essentially what we want is like UNINSTALL old msi and RE-INSTALL new MSI in one command.
We were wondering
if the REINSTALL/REINSTALLMODE flags value are correct ?
Sometimes we see an orphaned Windows Service in TaskManager. Any idea why the re-install command resulted in 2 instance of Window Service?
Suggestions would be grateful!
You produced a log - take a look and see if there are any mesasges about removal of components being unsupported. Also set MSIENFORCEUPGRADECOMPONENTRULES=1 on the command line and the install will fail if you broke a minor update rule. If it does fail, then the author of that MSI is breaking update rules and Chris' advice to do a major upgrade is required and not optional!
The services may not have ServiceControl actions to stop and start them, so they'll just keep running over the update because nothing is telling them to stop. This can be complicated by in-use files requiring updates because your silent install has no file-in-use dialog to prompt to shut down processes.
You can get an apparently orphaned service process if the service shuts down (the process ceases to be a service) but the containing process is still running. That might be normal if the service responds to the shutdown but continues afterwards for some time, that depends on the code in the service.
Your commandline indicates that you are doing a minor upgrade. Your requirements indicate a major upgrade would be more suitable for you.
How To: Implement a Major Upgrade In Your Installer
Minor upgrades are very picky and breaking rules are likely causing your duplicate service problems. See:
Changing the Product Code
Related
I am attempting to make sure certain software does not exist before installing the newer version. Long story short, vendor requires me to do so, and although they recommend me to repair after install, that causes other issues such as undesirable restart (trust me I tried /norestart and I have even tried to modify the stored msi package to make sure it does not restart) but over all it just gives us soo much headache without the result we want.
So I tried to simply uninstall this software ahead of installing their newer one since that seem to have higher success rate without unnecessary issues.
Now I am accomplishing this by running batch file via ExePackage (with WiX toolset) with Vital="no". I have to do Vital="no" because when the older installer does not exist and if I call msiexec /x, it returns the error stating
this action is only valid for products that are currently installed
When the older installation exists, it works fine, but when it does not it errors out.
Now Vital="no" works fine, but I would prefer to suppress the error with msiexec /x if I can.
Is there any known way to solve this?
In order to solve this problem, I checked the uninstall keys and only called msiexec /x on products that were listed. Though in my own case, we were switching installer tech (too many MSI bugs...) and were uninstalling older versions of our own.
Installation State: You can use VBScript to check for the installation state of a product if you know its product GUID (replace the sample GUID here):
Dim installer : Set installer = CreateObject("WindowsInstaller.Installer")
MsgBox installer.ProductState("{6C961B30-A670-8A05-3BFE-3947E84DD4E4}")
There are a number of possible installation states. Here is a more comprehensive script to check product installation state. Check section 7 here.
Major Upgrades: I assume you are aware of how major upgrades work? (uninstall of existing installation and install of newer version with options for what order this happens in). They can in reality uninstall any other MSI package on installation via settings in its Upgrade table. This includes even competitive products (a bit mad one would have to say). You can - however - not install them again easily from within MSI for a number of technical issues. You could install them via a Burn setup.exe bootstrapper (which I think you use).
If I execute a Wix installer for first time it will install as expected.
If I re-run the installer it correctly enters maintenance mode (Repair/Change/Modify)
However if I re-compile the installer between the initial install and the re-run, it treats it as new installer. I have tried using the same Product Id but when the newly compiled installer is executed, I then get a message saying it has already been installed and must un-install the previous version.
As part of our development I am trying to resolve some issues with the Maintenance UI and don't want to have to run the installer twice every time I wish to debug the maintenance wizard. I would like the re-compiled installer to be treated as if it were the original installer.
Thanks for any pointers you may be able to throw at me, or other suitable resource
Technically this is not something that you should do. By rebuilding, you are altering the package, which means it is supposed to have a new package code. When it has a new package code, but matching product code and version, it is a small update. You can skip the uninstall and install by instead performing a reinstall via msiexec /fvomus your.msi or msiexec /i your.msi REINSTALL=ALL REINSTALLMODE=vomus.
As another approach, if what you are testing doesn't depend heavily on machine state, you can tweak some of the entry conditions for the maintenance UI such that it occurs on a first-time installation, and ensure that the package cannot install. This puts you in a simpler reproduction loop, but will require transplanting your finished code back to the real scenario.
I am using Visual Studio 2013 installer to package my application. I then make a copy of the MSI, open it in Orca and remove all the dialogs to create a silent package. So I have two MSI's that should be the same other than one is silent and the other is not.
When I upgrade from a previous version (built in the same way) using the non-silent package, everything works perfectly.
However when I upgrade from a previous version using the silent package, it all works apart from I am left with 2 entries in Add/Remove programs. It all works though but looks ugly for the client. When i uninstall the latest version, Add remove programs still has the previous version listed in Add/Remove programs although actually the latest version is still installed.
As I say, the non-silent package works perfectly well, which leads me to think I must have everything setup correctly in Visual Studio and Orca must be doing something I didn't intend.
Any help would be much appreciated.
If you have two entries in Add/Remove Programs then the upgrade didn't work. A common reason is that one of the installs is Everyone and the other is Just me. If you delete the dialogs then you have altered the behavior that sets the ALLUSERS property, and your upgrade could default to Just me. In the absence of a decision to use one of these choices VS setups use ALLUSERS=2 which is defaulting to a per user Just me install, that's the likely reason. Elevation is involved too - VS setups would rather your MSI did a successful Just me instead of a failing Everyone if privilege state is not clear (and in MSI setups it often isn't).
You might need to go to the Property table and set FolderForm_AllUsers to "ALL" and ALLUSERS to 1 to force a per machine Everyone install.
How silent do you want it to be? If it requires elevation to install successfully then you need the elevation dialog to be shown or the install will fail silently if you force a per machine Everyone install.
I am seeing the following error while trying to uninstall. How can I uninstall the software when there is no folder WRT the software in the program files.
Note: I have deleted the software folder from program files.
Error Message:
System.IO.FileNotFoundException. could not load file or assembly or its dependencies. the system cannot find the file specified.
I need the solution on how to uninstall the software when there is no folder existing the program files.
Sounds like a very britty InstallUtil custom action that has a dependency on a file being installed with no exception handling if it's not found. Awesome! :)
Take the orginal MSI that you installed and edit it with Orca to remove the custom action from the InstallExecute sequence. Recache the MSI using the command:
msiexec /i FOO.MSI REINSTALL=ALL REINSTALLMODE=vomus /qb
Finally uninstall the application.
Broken Uninstalls: There are a few ways to approach this such as 1) trying to run the repair sequence of the installed MSI which might be able to pull files down from the original installation location or 2) run the original installer itself again - as in the install sequence rather than the repair sequence (must be the exact MSI file used to install the software originally), etc... These approaches are all vulnerable to failure and generally need some "hacking" to succeed.
Microsoft FixIt: This all leads to the recommendation of the last resort solution that is "sort of official", it is the Microsoft FixIt tool. It can be used to clean out broken uninstalls by "unregistering" the installation rather than running the actual uninstall for it. It should work. Never use it if you don't need to, there are risks.
Logging & Debugging: The above should work, but here is information on how to log an MSI operation: Different ways to create and interpret MSI logs to narrow down the cause of the problem seen.
Links: Below some general-purpose MSI uninstall resources. The first link lists cleanup strategies for broken uninstall - very hacky some of it. The second link lists different ways to invoke uninstall of MSI files - there are a lot of ways:
Broken Uninstalls: Here is a generic list of cleanup approaches for broken uninstalls - most of this is very hacky, only use this if you really need to.
MSI Uninstall Approaches: Uninstalling an MSI file from the command line without using msiexec.
We are installing several web sites using msi's as part of continuos integration tests.
For each build we want to uninstall the old msi and install a new one.
Problem is we do not have the old msi after the build server has done a get latest and rebuilt the system.
Is there a way in which we can uninstall the msi without having access to the orginal msi?
Yes you can, if you know the product code. Just type
msiexec /x [ProductCode]
on the command line. Or you could do it through the Add/Remove programs applet.
If you want to find the physical file, Windows actually stores a copy of the msi when it runs it - you will find it somewhere in your %WINDOWS%\Installer folder, but it will have been given a random name so could be quite hard to find :)
Alternatively if you don't know the product code (which you should) then try searching for your app name under the HKEY_CURRENT_USER\Software\Microsoft\Installer and HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData registry keys, you will find the product code there. (quick hint: you can also search for UninstallString values in the registry).