How to update an MSI in a remote macine - windows

I created an msi that that installs my application. Now i want to do an update the msi. I used
msiexec /fvomus "application.msi"
This showed no error. But when when i try to update an application in remote machine it shows the below error
The installation package couldn't be opened. Contact the Application
vendor to verify this is a valid Windows installer
I used the below command for remote installation
msiexec /fvomus "//server/c$/Program Files/path_to_my_application/1.msi"

Assuming you want to update a product you've installed from an MSI package:
msiexec /f... does not update anything. The /f means that it's a repair, and that means to check that the currently installed product is correct. If you're using WiX and you want to upgrade an installed product then the MajorUpgrade element is the simplest and most reliable approach.
That error message is too generic to provide a simple answer. It may be that the MSI file is already open in another app, or you don't have the privilege to access that file (IMO the most likely explanation).

Related

Wix re-install msi with windows service fails randomly

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

Uninstalling msi via msiexec fails with a 'only valid for applications installed' message

We have a legacy software installation that we're trying to remove from our organisation. We have different versions and are trying to create a universal uninstaller for all versions. We've come across a particular release that doesn't seem to be able to be uninstalled via command line though. And it's proving difficult to create a workaround.
I've found the GUID of the application in the registry via
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
And the command I run is:
msiexec /x {080FDF44-6D15-4D2E-977E-74D5168198E7}
I get an application prompt asking me if I want to uninstall the product, so I click 'Yes'. And then it looks like it's starting but never actually does anything. So I dug round the registry and found another GUID in:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\Userdata\S-1-5-18\Products\44FDF08051D6E2D479E7475D6118897E
If I run the same command as above with the different GUID, I get the application confirmation box asking for uninstall then after clicking OK, I get an error saying:
The installation package could not be opened. Verify the package exists and you can access it.......
I've been into C:\Windows\Installer into the folder with the above GUID and all that is in there is an icon and an *.mst file. In the root of C:\Windows\Installer, there is an *.msi called the same product in the details but with another version ID of:
8A2C4F93-4B31-4474-B9F2-2E51BF5D71A8
If I run the msiexec against that ID then I get a confirmation box again then another error which says
The action is only valid for products that are currently installed.
If I run the uninstaller, it uninstalls fine from the programs and features and uses the generated *.msi for the uninstalled (e.g. C:\Windows\Installer\241a6.msi and matches the product ID of 8A2C4F93-4B31-4474-B9F2-2E51BF5D71A8). This will change form machine to machine. Any other ideas on how to get this off in a neat and managed way?
You can't dredge the registry for ProductCode guids because they are obfuscated. If you don't really know the ProductCode, then look at ways of enumerating installed products. For example, the direct C++ way is MsiEnumerateProducts, and C# pinvoke equivalents, something like this:
MSI Interop using MSIEnumRelatedProducts and MSIGetProductInfo
Then you will get the actual ProductCode and can get other info with it.
If sometimes it doesn't work when you are absolutely sure of the ProductCode, then it was perhaps installed in a per user context that's different from the one you're running the program with.
Also, for MSI-installed products Windows doesn't use the uninstall string, it just uses the ProductCode directly. Again, registry dredging is not the right thing when there are actual APIs specifically to enumerate installed MSI products.
If an uninstall requires access to the original MSI that it was installed from, then there are at least two reasons:
The MSI has an unconditional ResolveSource action that forces it to ask for the oroginal MSI file.
The cached version of the MSI file has been removed from C:\windows\installer.

WiX Toolset: File extensions registering asking for feature install on different user

I am having trouble with my WiX installation in that I am registering a file extension but because you have to tie every component to a feature, I can't get the feature to install to "All Users"?
Specifically what is happening is I install the MSI under an admin account. The MSI is not located in a shared location that is accessible by all users. The extension appears to register for the other users however when other users click on the file (with the newly registered extension) to open it, it tries to look for the original MSI first to install a feature. If the MSI is found it will open the installed application like normal, otherwise it errors. For the admin account that installed the MSI, it does not ask to install the feature from the MSI (even if I delete the MSI before clicking on a file with that extension)
I have set the installlevel of all the features to "1" and set the TypicalDefault to "install" and InstallDefault to "local". The package is also set to install at the machine level.
Is there something else that needs to be set?
See if this helps: Troubleshooting unwanted self-repairs using the Event Viewer
Basically you need to understand why the repair is happening (which component key path ) and then remediate it. Alternatively you could wrap your MSI with a EXE (WiX Burn) and cache the MSI in a location that users can access if the repair is truly needed.

Error 1001. Exception occured while initializing the installation

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.

Uninstall an MSI with msiexec fails with new version of MSI

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).

Resources