Monday, December 8, 2014

Wrapping GRR Windows Installers as a .MSI File


GRR Client installation files for Windows are provided as .EXE (Executable) files.  These files can be installed interactively or pushed to clients using a software management tool such as SCCM.  Administrators intending to deploy GRR using Group Policy Software Installation will find that they need installers packaged as a .MSI (Microsoft Scriptable Install) file.  This post describes two ways to wrap the GRR Client .EXE into a .MSI file as required by Group Policy.

The first option is to use an open source tool called WiX Toolset.  It’s a developer tool capable of creating complex software installation packages.  Using the toolset involves the creation of a XML configuration file (sample provided) and a few command line operations.


An alternative is to use a commercial tool like MSI Wrapper.  This purpose-built tool offers a point and click experience.  I’ve evaluated the free version of the MSI Wrapper and found it adequately met the needs of this wrapping task.

Please continue reading below for a step-by-step guide of using each method.

WiX Toolset

Step 1) Create a grr.wxs configuration file in the same directory as your grr client installer exe.

An example in provided below.  Steps 1a -> 1c are instructions for modifying the values highlighted in bold.

Step 1a) UpgradeCode = a unique GUID for this installation package.  You can create a new one in your tool of choice or using GuidGen.


Step 1b) Version = the version of GRR you are packaging.


Step 1c) Source = the name of the file to be packaged.


Example grr.wxs


<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*" UpgradeCode="9DA302DE-B45A-4EE8-9758-E547CF3D57F3"
           Name="GRR Agent" Version="3.0.0.2" Manufacturer="Grr Opensource" Language="1033">
     <Package InstallerVersion="200" Compressed="yes" Comments="Windows Installer Package"/>
     <Media Id="1" Cabinet="product.cab" EmbedCab="yes"/>

     <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="TempFolder">
           <Directory Id="INSTALLDIR" Name="grr">
              <Component Id="ApplicationFiles">
                 <File Id="ApplicationFile1" Source="grr_3.0.0.2_amd64.exe"/>
              </Component>
           </Directory>
        </Directory>
     </Directory>

     <CustomAction Id="LaunchApplication" FileKey="ApplicationFile1" ExeCommand="" Execute="deferred" Return="check" Impersonate="no"/>
     <InstallExecuteSequence>
        <Custom Action="LaunchApplication" Before="InstallFinalize" />
     </InstallExecuteSequence>

     <Feature Id="DefaultFeature" Level="1">
        <ComponentRef Id="ApplicationFiles"/>
     </Feature>

  </Product>
</Wix>


Step 2) Run WiX Tools

Candle compiles the wxs file into a WiX object file.  
Light is a linker for the object file and produces the MSI file.
c:\grr-msi>"\Program Files (x86)\WiX Toolset v3.9\bin\candle.exe" grr_3.0.0.2.wxs
Windows Installer XML Toolset Compiler version 3.9.1006.0
Copyright (c) Outercurve Foundation. All rights reserved.

grr_3.0.0.2.wxs


c:\grr-msi>"\Program Files (x86)\WiX Toolset v3.9\bin\light.exe" grr_3.0.0.2.wixobj
Windows Installer XML Toolset Linker version 3.9.1006.0
Copyright (c) Outercurve Foundation. All rights reserved.



Step 3) Done.
A new .msi file will be created in the directory.




MSI Wrapper

Step 1) Launch the tool.

Screen Shot 2014-12-01 at 11.25.01 AM.png

Step 2) Provide paths to the installer (exe) and output (msi).
Screen Shot 2014-12-01 at 11.25.48 AM.png

Step 3) Leave the Application Id blank.  Create a new Upgrade code.
Screen Shot 2014-12-01 at 11.26.06 AM.png

Step 4) Manually enter the Name, Manufacturer and Version.
Screen Shot 2014-12-01 at 11.26.58 AM.png

Step 5) These fields are optional. Next.
Screen Shot 2014-12-01 at 11.27.08 AM.png

Step 6) No arguments are necessary. Next.
Screen Shot 2014-12-01 at 11.27.16 AM.png

Step 7) The exe has been successfully wrapped as a MSI file. Done.

Screen Shot 2014-12-01 at 11.27.28 AM.png


4 comments:

  1. Please fix the screen shots that are supposed to be display for the MSI Wrapper configuration. Thanks!!

    ReplyDelete
  2. Sorry about that, fixed. The person who wrote the original post left Google and their account was deactivated, taking the images with it.

    ReplyDelete
  3. http://wixtoolset.org/schemas/v4/wxs

    this is the new URL that works witht he WiX tool. the URL on the sample XML does not work

    ReplyDelete
  4. when i run WiX lighter, i get the following error.

    *******************************************************************************************
    C:\Users\\Desktop\GRR Client>"\Program Files (x86)\WiX Toolset v4
    .0\bin\light.exe" grr.wixobj
    WiX Toolset Linker version 4.0.3922.0
    Copyright (c) Outercurve Foundation. All rights reserved.

    C:\Users\\Desktop\GRR Client\grr.wxs(12) : error LGHT0103 : The s
    ystem cannot find the file 'GRR_3.0.7.1_amd64.exe'.

    C:\Users\\Desktop\GRR Client>
    ********************************************************************************************

    ReplyDelete