Admin Installs

Jan 23, 2015 at 12:40 AM
Does Wix# provide a means of creating admin installs (msiexec /a)?
Coordinator
Jan 25, 2015 at 12:46 PM
You can execute any MSI with "msiexec /a" meaning that any MSI built with Wix# (or any other framework) can be installed as "admin install".
Did I understand you question correctly?
Jan 26, 2015 at 4:42 PM
Thanks for the reply. What I meant by "create an admin install" was: Can I set the "...list of properties that are set at the time of an administration installation"?

"The ADMIN action is the top-level action used to initiate an administrative installation. When this action is executed the installer calls the actions in the AdminExecuteSequence and AdminUISequence tables to perform the administrative installation."

(quoted from: https://msdn.microsoft.com/en-us/library/aa367541(v=vs.85).aspx).
Coordinator
Jan 27, 2015 at 9:03 AM
OK. I see.
Currently only InstallExecuteSequence and InstallUISequence are supported. It is not a problem to extend the enum but I am not fully convinced it is the MSI feature that makes sense to bring to Wix#. As many other MSI features it just may not have enough practical value.

In this thread (http://stackoverflow.com/questions/5564619/what-is-the-purpose-of-administrative-installation-initiated-using-msiexec-a) the post marked as the answer sums it up very well.

However considering the very little effort of implementing it I have commuted the change (b4296eefb197) in the Sequence enum. It will be available in the next release.
Jan 27, 2015 at 4:44 PM
Thanks for doing this.

We use the Admin install extensively in the Enterprise environment where the users do not know the values for the properties needed to install the application - but the admin does. For example, the name of the database, the server it's installed on, the db platform (Oracle, MSSQL,..), what modules they are licensed for any many other settings to properly setup the app. In this scenario, the "Admin" run msiexec /a and answers all the questions needed for their environment. When the admin clicks "Finish", another MSI is generated and placed on a shared folder for all users to run with only a progress bar showing.

What is the timeframe for the next release?
Coordinator
Jan 28, 2015 at 9:17 AM
Edited Jan 28, 2015 at 9:19 AM
It is done in the today release (v1.0.6.0).

I have added an AdminInstall sample that demonstrates how to use the technique. Please note that the sample is intended to demonstrate how to ensure a proper setting up of the AdminExecuteSequence but not to to prepare a complete AdminInstall MSI.

BTW, the desired behavior could also be achieved with previous releases. You can intercept and modify Wxs just before it is fed to the WiX compilers:
Compiler.WixSourceGenerated += Compiler_WixSourceGenerated;
...
static void Compiler_WixSourceGenerated(System.Xml.Linq.XDocument document)
{
    XElement installExec = document.Descendants("InstallExecuteSequence").First();
    XElement adminAction = installExec.Elements()
                                      .Where(e => e.HasAttribute("Action") &&
                                       e.Attribute("Action").Value.EndsWith("MyAdminAction"))
                                      .First();

    adminAction.Remove();

    installExec.Parent.SelectOrCreate("AdminExecuteSequence").Add(adminAction); 
}