20091103

Using Group Policy and MSIs to copy files to computers with WiX

For some reason, unknown to the public, Microsoft doesn't make it simple to copy files to computers. You can write a script to run on startup, but it runs on every startup, and seems to cause the fast logon to be bypassed.

WiX creates MSI files from XML, and isn't too complex to get started with, although at the other end of the spectrum it's used to make the Office 2007 installer.

We'll need some GUIDs, I used http://createguid.com/

I've only spent 2 hours on this, so it's probably all wrong, please correct in the comments:

<?xml version='1.0'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product Id='guid 1' Name='product name' Language='1033'
Version='1.0.0.0' Manufacturer='company' UpgradeCode='guid 2'>
<Package Id='*'
Description='description'
Comments='copies file to all users app data'
Manufacturer='company' InstallerVersion='200' Compressed='yes' />

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


<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="CommonAppDataFolder">
<Directory Id="INSTALLDIR" Name="dirname">
<Component Id='component name' Guid='guid 3'>
<File Id='idname' Name='filename' DiskId='1' Source='filename' />
</Component>
</Directory>
</Directory>
</Directory>

<Feature Id='MyFeature' Title='My 1st Feature' Level='1'>
<ComponentRef Id='component name' />
</Feature>
</Product>
</Wix>

Save that as something.wxs

Notes: Package Id='*' makes WiX generate a GUID each time, not sure if the same would work with guid 3. No idea if Feature or Media are needed. CommonAppDataFolder can be changed, there's a list at http://www.nateperry.org/w/index.php?title=Wix:Examples#Directories

Put 'filename' in the same dir as the above.

Download WiX, install. From command line run:

"\Program Files\Windows Installer XML v3\bin\candle.exe" something.wxs
"\Program Files\Windows Installer XML v3\bin\light.exe" something.wixobj

And you should end up with an msi file in the same dir to add to your GPO

No comments: