How to interactive a silently installing msi? (Progress data and cancel it) - installation

For some reason, we are delivering a product with our own install GUI, that means, we will run the msi installation silently background.
By using the MSI API "MsiInstallProduct", I can install the product silently, but I have no idea how can I get the progress data of this installation and how can I cancel it.
Anyone has some ideas?

UPDATE June 2018: Although the tool shown below is no longer available for download, I found it via Wayback machine. I assume it is OK and legal to link to it, seeing as the tool was freeware. Updated links below.
UPDATE: This tool from Wise is regrettably not downloadable anymore. I am not sure if it is OK to distribute it either. It seemed to be a free tool distributed as part of their main Wise Package Studio suite, but I don't think it is open source. I wish they would release it as an open source tool.
The Wise packaging products have been discontinued due to a number of legal issues.
I believe you can get the progress via the MSI API, but if I were you I would just show the progress bar from the MSI itself after invoking the install via msiexec.exe.
MSI supports several different installation levels (full, completely silent, basic GUI, reduced GUI etc...). In your case it sounds like you want a basic UI. This yields a progress bar where you can hide the cancel button, and optionally show a completion modal dialog:
Install silently with progress bar, no cancel button and no modal dialog at end:
msiexec.exe /I "Test.msi" /QB-!
To avoid having to construct these silly msiexec command lines manually, use the msi command line builder tool from Wise: http://www2.wise.com/filelib/WICLB.exe (resurrected from Wayback machine).
Please run the download by virustotal.com for safety.
Related:
installation using msi.exec open help options every time
Silent Install of MSI
How to install an MSI package from a command prompt
How do I force the Windows MSI installer to perform a complete install?
Silent Installer with custom selection

Here is a sample project that appears to do what you are referring to:
http://www.codeproject.com/KB/cs/msiinterop.aspx

You need to specify an external UI handler using MsiSetExternalUI or MsiSetExternalUIRecord before MsiInstallProduct (the latter is nicer, but has a higher MSI version requirement). The function you specify will be called for each message Windows Installer wants you to process. This will give you the data, and a chance to respond tell it to cancel. If you require MSI 4.5 or later, you can use an embedded external UI handler DLL, which does not require a bootstrap.

Related

How do I uninstall an app from control panel (WIX)?

I have a complex installer (Wix) that is in multiple parts. One part installs some camera drivers (32 OR 64 bit depending on what is called for) via an EXE file, NOT AN MSI FILE. Once my app is installed, using Wix, the camera drivers/executable appear in Programs and Features in my Control Panel. Before I can upgrade my app, I have to uninstall the camera drivers (and then install the latest version). There is no uninstall EXE/MSI in the camera's install directory. I can figure out how to check if the camera is installed (although I'm not there yet), but how do I uninstall the camera w/o manually going to control panel. How do I automate this process?
Note: I look thoroughly online for a solution, and while a lot of threads came close, nothing actually answered this question.
Note: after more searching, I ran across WMIC(http://www.tech-recipes.com/rx/2947/windows_uninstall_application_command_line/). Can I automate via WMIC? To make things even stranger, my camera doesn't show up in the WMIC list, it IS in Control Panel though.
Thanks in advance!
-Dan
If the command appears in the Add/Remove programs applet, then the information is available in the Uninstall Registry keys. By enumerating the entries in this registry key, you should be able to determine the information necessary to perform an uninstall of the component in question. Typically the UninstallString gives the proper invocation syntax to uninstall the component without needing any user interaction.
Some applications have specific behaviours, and you can have both a ModifyPath and UninstallString option in the registry. The ModifyPath option would be for the check/reinstall/fix/add-remove items options, while the UninstallString should perform an uninstallation, hopefully without needing user interaction.
For the app in question, it takes the program name and the /uninstall parameter to get it uninstalled in this case without having to press any options.
Some uninstallers take the /q or /quiet option which performs the uninstallation without any user interaction - this is all down to the app in question.

Error 1001 on uninstall

Error 1001. An exception occurred while uninstalling. This exception
will be ignored and the uninstall will continue. However, the
application might not be fully uninstalled after the uninstall is
complete
I can't uninstall or install the application. This particular box is not able to access the internet and I don't have physical access so most of the googleable results are not useful since they suggest running an exe from Microsoft.
What are the manual steps to resolving this issues. There is no way I can physically reach this machine nor does there seem to be a way for me to get files onto it. This is code that I'm developing and testing. I've tried repair and remove which fails out. I've scoured the registry but I must be missing something here.
If this is better on SuperUsers I'll gladly move it.
I had the same uninstall issue removing an application that I wrote that includes two Windows Services, ergo custom actions were unavoidable. I solved it be running PC Tools Registry Mechanic. Unfortunately, Symantec has retired that product. However, Microsoft Fixit has been known to help with registry related problems. http://support.microsoft.com/mats/Program_Install_and_Uninstall
1001 always means an InstallUtil (Installer Class) custom action has failed. It's impossible to give you a more detailed answer because, well, it's a "custom" action. There is no telling what code is throwing an exception.
If you want to save this machine and not have to rebuild it, you have to log the uninstall to get the name of the custom action that's failing, use ORCA to tweak the MSI to cut out the custom action, recache the MSI and perform an uninstall.
You've now learned the hardway why to:
1) Always use VM's to test your MSI during the development / test life cycle
2) Avoid using custom actions whenever possible
3) Never use InstallUtil custom actions. They are not a good pattern or practice.
1.Goto control panel then right click to get repair option.
2.Repair it and again uninstall after repair.
Here you go the software is uninstalled..
Make a verbose log file:
msiexec.exe /I "File.msi" /QN /L*V "C:\Temp\msilog.log"
/I = run installation sequence
/L*V "C:\Temp\msilog.log"= verbose logging
/QN = run completely silently
Open it in notepad, and search for value 3. Also check the system's event log for any clues.
Most MSI errors like this will probably involve custom actions, or service configuration like Chris says.
If this is really important to chase down you should get hold of Orca - the SDK tool used to inspect MSI files. You can see some screenshots of the tool in operation in this answer. And then inspect the Custom Action table and the end of the InstallExecuteSequence table (order by sequence number) and report what entries you find there.
Unfortunately it seems the only way to get hold of Orca is by installing the Windows SDK. Alternatively you can download a trial version of one of the third party installer tools.
My guess is that there is an immediate mode custom action after InstallFinalize that is returning an error code of some sort. In short you can report all items AFTER InstallFinalize in the InstallExecuteSequence and we can probably narrow it down.
That resolve the 1001 problem uninstalling windows service in Windows Server 2012 R2 I did:
Go to program and select Modify Service
Select repair Service
Close the applet, select again Modify Service
Now Select uninstall.
I hope this help

An installed program's "windows Installer" comes out when I launch a different application

When I launch an application, a windows installer from a previously installed program keeps popping up. The program still exeists in the Server and it's working fine. The installer popup, after clicking "cancel" will eventually dissapear.
I'm not interested in solving this problem, I'm just wondering how does the windows installer decides what to install? I mean to say, what's the mechanism? How and who triggers the windows installer?
Thanks for any reply!
This is the self-repair mechanism triggered automatically by the OS. Along with the above enumerated reasons it can also be triggered if:
A feature having been installed as advertised/install on first use/install when required
Files inappropriately shared between components, features, or products, which can lead to the resource being uninstalled while a product is still using it
A product with per-user data having been installed on a multi-user system by one user and then launched by another user
To investigate the resource whose absence triggers self-repair, look in the Application section of the system's event log. Self-repair events are displayed with source "MsiInstaller".
If the installer is indeed trying to add a resource required by another application the best solution would be to let it finish, and it should no longer appear after that.
Usually this behaviour appears when one of the following is true:
the install process was not completed successfuly
the registry entries for this program were deleted / corrupted
(not finding an appropriate registry entry is a trigger)
the install program's updatemanager was corrupted / disconfigured / cancelled on the previous run
The solution usually is to completely uninstall the program, to check that all folders and registry entries were indeed removed and then to re-install the program.

Need an auto update programme that will install the software without any manual interference

i want to create a programme to auto update the software on client machine my question is how to run auto-installer to update the software.Actually we can download the current version of the software and we need to start installation without any manual interference.Once user click on the install update software need to be installed automatically without any wizard. any help will be appreciated.Thanks & Regards Harry.
It depends on the installation technology you use.
With MSI, you can pass /passive switch to msiexec command to prevent any interaction; add /norestart to prevent automatic system reboot. In case of MSI, you can also use Windows Installer API functions to fully programmatically install the package.
UI level can also be controlled from within the MSI package: from no UI at all to fully fledged wizard-like GUI. For example, you can display wizard interface when user installs your application for the first time; when you're preforming upgrade, you can show user only the progress or you can completely hide the UI.
Like #AlexeyI says, it depends on the installer you're using.
For InstallShield-created 'setup.exe' installers, you pass the /s(ilent) switch. If you need to provide answers to dialogs you also supply a response file containing the responses you want to give.

Inno Setup OR NSIS Automatic Rollback on Error / Abort of Install

Is there a integrated Rollback-Action in any of the Installer-systems mentioned above? I know it's available in Windows Installer, but it seems to be missing in any other system I looked into.
Is there any system like Windows Installer that actually supports automatic Rollbacks?
NSIS does not support this because a script could do anything (Call any Windows API, use NSIS plugins to perform advanced tasks etc) and it would be impossible to know what and how to roll-back. But if you code the uninstaller to handle half-baked installs, you execute the uninstaller.
Innosetup does not do what I'd call a rollback. Case I tested was installing a newer version of a file over an older file, when cancelled IS displayed a box saying 'rolling back changes' however the newer file was still present (old file gone).
NSIS does not support automatic rollbacks, you have to code it yourself.
InnoSetup, however, does provide automatic rollback support. Special care needs to be taken to invoke it if you are using special scripts or hooks, but a simple install will have it "for free."

Resources