-1

I am currently working on a tool for system administrators that can be used to update all clients of a Windows AD. It needs to work with Group Policy and SMS for the purpose of doing mass-updating. Therefore I need the tool to result in a MSI file.

Is it possible to create a MSI file that does not install anything but instead only does a custom action (ie. run a script or exe-file).

Best Regards Jakob Simon-Gaarde

2 Answers2

0

Yes, it is possible. Shameful, but, possible.

You can make a square peg fit in a round hole but you lose all of the intended benefits.

FWIW, SMS is now called SCCM and it can call EXE commands.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • Shameful? What's shameful here is the Microsofts MSI-system. Compared with ie. DEB/APT that distinguish between binary, source and virtual packages and via the repository concept supports inter-package dependencies, MSI is so unflexible. – Jakob Simon-Gaarde Jun 01 '13 at 07:59
  • Yes, shameful. If you are such an expert, you could explain why. In fact, you wouldn't even have to ask the question. – Christopher Painter Jun 01 '13 at 10:26
  • If you tell us what your EXE does I bet you I could tell you how to do the same thing in MSI without violating best practices. – Christopher Painter Jun 01 '13 at 10:35
-1

Found a hackish way to solve my problem:

<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
    <Product
        Name='MVLicense Updater' Id='f8fc0a30-c138-1fe2-838b-0845200c9a66'
        UpgradeCode='00ca86a0-c889-12e2-8f8b-0800200c9a66'
        Language='1033' Version='1.0.0.0' Manufacturer='My Company'>

        <Package Id='*' InstallerVersion='200' Compressed='yes' />

        <Media Id='1' Cabinet='my.cab' EmbedCab='yes' />

        <Directory Id='TARGETDIR' Name='SourceDir'>
            <Directory Id='ProgramFilesFolder'>
                <Directory Id='INSTALLDIR' Name='My-Updater'>
                    <Component Id='Readme' Guid='68fef080-c87b-34e2-8889-0824200c9a66'>
                        <File Id='ReadmeTXT' Name='readme.txt' Source='readme.txt' Vital='no' />
                        <RemoveFolder Id="INSTALLDIR" On="uninstall" />
                    </Component>
                </Directory>
            </Directory>
        </Directory>

        <Feature Id='Complete' Level="1">
            <ComponentRef Id='Readme' />
        </Feature>

        <CustomAction Id="ForceError" Error="1602"/>
        <CustomAction Id="RunMyUpdater" BinaryKey="MyUpdaterExe" ExeCommand="dummy" Return="check"/>

        <InstallExecuteSequence>
            <Custom Action='RunMyUpdater' After='InstallInitialize'></Custom>
            <Custom Action="ForceError" After="RunMvlupdate"></Custom>
        </InstallExecuteSequence>

        <AdminExecuteSequence>
            <Custom Action='RunMyUpdater' After='InstallInitialize'></Custom>
            <Custom Action="ForceError" After="RunMyUpdate"></Custom>
        </AdminExecuteSequence>

        <Binary Id="MyUpdaterExe" SourceFile="dist\myupdater.exe" />
        <UI>
            <Error Id="1602">We have a problem</Error>
        </UI>
    </Product>
</Wix>

This does the job of running my executable that does some configuration stuff based on calling an internet service and then rolls back the installation because I force an error to occure.

  • This is a horrible, horrible antipattern. But if you are really going to do it, you should wrap your EXE with the Quiet Execute Custom Action so the standard output/error can at least be captured into the MSI log. Also you shouldn't force an error / rollback because frankly the rollback isn't really rolling back anything. MSI has no idea what your out of process EXE did. Instead you should have an another EXE that acts as an uninstall custom action. Otherwise you can mark the installer as a system component to disallow uninstall. – Christopher Painter Jun 01 '13 at 10:32
  • Alternatively you can disable the PublishProduct standard action if you simply don't want it registered with the system. But to always report an error as imply that a rollback occurred when in fact something did happen really gives the operations folks the wrong idea. – Christopher Painter Jun 01 '13 at 10:33