MSI Application Packaging
MSI Application Packaging
What Im Teaching:
Packaging for Different Environments Best Practices in Packaging Group Policy Object Best Practices What is an MSI, really?
What is an MSI?
You were taught that an msi is:
A database containing information about all the actions to be performed during the installation.
Features?
Configurable via Policy settings
http://msdn.microsoft.com/en-us/library/aa372058(VS.85).aspx
Rollback when encountering errors Administrative Installs Advertisement Self-Repair Supports Per-User and Per-Machine installs Patches/Transforms
Technology-based
AD vs. Novell Remote Access vs. Console Interactive vs. Automated Install
User Environments
Goal: Build the installer once
Sorry, still wont be 100% portable
Considerations:
Permissions Labs/Kiosks vs. Desktop/Laptop/SOC Network Wired, Wireless, None Preferences Persistence? Storage space user profile, network drive Security
If you ever successfully build the perfect MSI for one environment, itll be useless to all others.
Labs
Permissions must be right for user Launch conditions on vendor MSIs often look for admin user data must be redirected to network
Laptops
No Install on 1st use (read: Office) Cannot require network drives
SOC
Downloaded, interactive installs So where the heck do you put the default save location?
Initially assume user level permissions on a desktop storing files on local drive. Make modifications as needed.
Distribution/Run Options -> Group Policy Preferences Launch Scripts vs. Advertised Shortcuts No Preinstall Schedule in AD, only at reboot NAL doesnt support Advertised Shortcuts
If its in the NAL, dont use Adv. Shortcuts in Start Menu
Random Notes
Validation
ISEs Orca, Installshield, or Tuner
Errors vs. Warnings vs. Info
Testing
install via double-click/script install via GPO uninstall via script/GPO 1st launch as "user where does it save files? disconnected operation vista? x64? plain xp? Make sure to test w/o alwaysinstallelevated Does the second user get the same user experience as the first?
Types of Installs
Multiple MSIs can be better than a single large one Snapshotting MSIs Dont Do it!
However, once in a great while is needed if vendor MSI is absolutely terrible, but cleaning process is much harder and errors have greater impact.
Deployment
GPO Zenworks Scripts
Microsoft Cabinet Software Development Kit http://support.microsoft.com/kb/310618 MSI Cleanup Utility - http://support.microsoft.com/kb/290301
Installshield AdminStudio
Different Versions
http://www.acresso.com/products/licensing/adminstudio.htm?link_id=rightnav
Standard No custom action/transform editor, greatly reduced MSI testing Professional Better Testing (user permissions, etc), Installscript -> MSI, vbs custom actions Enterprise Citrix support, Central App catalog, automated testing
Repackager
When do you use the installation monitoring vs. snapshotting?
Installation Monitoring works well when there is a single installer Snapshot works well for apps that have a bunch of chained installers (ArcGIS or Office), have no executable installer (WinSCP, Eclipse, VPython), or does install-time compiling (Adams) Always exclude reg keys/directories at the highest level (ex: HKCU or WindowsFolder) You still have to clean the msi even with Installation monitoring
InstallScript
Repackager can do Installscript Scan which turns an isscript MSI into a normal MSI.
Only works with Installation Monitoring or SingleStep Snapshot
isscript.msi Same Product Code for all versions. Do not ever assign via GPO. If Installscript Scan doesnt work:
Property ISSETUPDRIVEN=1 InstallExecuteSequence OnCheckSilentInstall, set Condition=0
Orca
Direct Database Editor When to use?
Removing launch conditions Un-advertising shortcuts Changing install levels for features Looking at transforms Searching the Database Validation
Issues:
Crashes on Vista Save Transformed as drops any streamed .cab files
Windows updates, Installshield updates Reboot right before beginning the snapshot For the love of God: Apps go under C:\Program Files
HKCU\Software\Microsoft\Explorer <- MRU HKLM\Services\ <- mostly reboot trash HKLM\Software\Microsoft\Cryptography\RNG DHCP Renews/Firewall Epoch Log Files
Fixing Things
PATH De-Advertising Shortcuts Swapping out the Username UI
Desktop Icons usually are bad Default save location should be under user profile (use transforms for network location)
Random Notes
Save the project before hitting Build when using Repackager to create an msi.
Allows the ability to go back and choose building an isolated msi Sometimes you can run out of space/memory when building a large MSI and the repackager might crash
If MSI or Transform references a network location via the DrLocator table (ex: to figure out if K:\ exists) the network location must be there during the assignment of MSI in GPO
Filtering
Use Groups Authenticated Users is bad WMI Filters
You can filter on way more than just the OS http://techies.ncsu.edu/wiki/Group_Policy_WMI_ Filters
Prerequisites
Determine if the Prerequisite is tied only to the particular application.
If so, include it in the snapshot If not, install it via run once style scripting
Isscript.msi is terrible Do not include VBA, DirectX, MDAC, or anything else like them in a snapshot.
Upgrades
Options
Assign new MSI to same GPO New GPO/group with upgrade set Uninstall / Reinstall
Logging
System Key: [HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer] Value Name: Logging Data Type: REG_SZ (String Value) voicewarmup = Verbose output, Out-of-disk-space messages, Status messages, Initial UI parameters, all Error messages, non-fatal Warnings, start up of Actions, action-specific Records, out-of-Memory or fatal exit information, User requests, terminal Properties
Saves MSIXXXX.log in %TEMP%
Properties
http://msdn.microsoft.com/en-us/library/aa370905(VS.85).aspx
Property Table
ALLUSERS = 0 Per User; 1 Per Machine; 2 Try Per Machine first ARP* - Configure Add/Remove Programs INSTALLLEVEL Controls which features get installed REBOOT = Force/Suppress/ReallySuppress TRANSFORMS = Path to transforms REINSTALLMODE = omus (reinstall files, registry, and shortcuts); v recache msi SOURCELIST Specify any number of network locations (only used for new installs/advertisements)
Codes
GUIDs Unique 8-4-4-4-12 number in UPPERCASE hexidecimal {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} GUIDGEN Windows App included in Visual Studio to generate GUIDs. Product Code GUID that specifies the Product. Major versions should change Product Code. In Property Table. Package Code GUID that specifies the Package. Any change to Package should change the Package Code. Upgrade Code GUID that specifies the Product line. All Packages/Products for a given application should have the same Upgrade Code. In Upgrade Table. May have multiple Upgrade Codes.
TIP!
Upgrading an Application via Group Policy assignment requires that the upgrade code for the old application be in the Upgrade Table for the new applications msi. The old app will be uninstalled and the new one installed at next reboot.
Trick!
You can use this for replacement of an application rather than just upgrades. By adding the upgrade code from SpyBot to a new Ad-Aware msi, you can upgrade it.
Sequencing
{Admin, Advt, Install}{Execute, UI}Sequence
Admin Used when doing admin install of the msi Advt Used when advertising the msi Install Used when installing the msi Execute Required Actions UI Interactive-only Actions AdvtUISequence is not valid
Conditions Supports <, >, <=, >=, =, <>, NOT, AND, OR, XOR
http://msdn.microsoft.com/en-us/library/aa368012(VS.85).aspx
Sequence Number Executed in order. Negative only execute if terminated. Nulls are never executed.
MSI Construction
Feature Logical portion of the product Component Atomic piece of the installer (a file, a directory, reg keys from a single hive, a mime type registration, etc.) FeatureComponent Maps atomic pieces to their feature Attributes bitmask that controls which whether atomic unit is favored local, favored source, shared, permanent Conditions
Notes
Features have a parent/child relationships A component can be mapped to multiple features
KeyPaths
Keypath is what Windows Installer looks at to see if a repair is required. A component keypath can be a directory, a file or a registry value.
Do not use KeyPaths that are subject to change
Can cause unintended repairs (as in every time) Can backrev files/reg keys that are supposed to be updated
Custom Actions
Types of Custom Actions
http://msdn.microsoft.com/en-us/library/aa368066(VS.85).aspx
Common types:
Type 6 vbscript embedded in a stream Type 35 Directory set with formatted text Type 51 Set Property with formatted text
Cannot use the wscript object with Type 6 Custom Action Examples of Type 6 Scripts Firefox 2.0.0.6
Distribute files to network drive at first launch Write out a config file w/ user-specific information
Transforms
The Good
Change default save locations Multiple configurations for common app Many vendors provide tools to generate them Can have Binary streams
Prefixes
Transforms
: - transform is embedded in msi @ - look at same folder as msi for transforms
Environment
* - Denotes System Env variable [~] Append/Prepend (ex: [~];c:\syb12\bin) Removal: !, on install; -, on uninstall; !- on {un}install
Advertisement
Using Group Policy:
Add/Remove Programs Install on demand User Assignment of Software Packages This doesnt end up working too good
Advertised Shortcuts
Benefits: Per-User settings, launch scripting via Custom Actions Issues: Launch conditions includes all types of installs
Recommendation:
Only use Advertised Shortcuts when you need them. Note: Installshield will automatically make most shortcuts advertised when creating the MSI via snapshot.
Self-Repair
The Good
Looks for the KeyPath of a Component in the MSI, and if its not there or different, it repairs. Includes loading COM objects.
The Bad
Unintentionally Forcing Registry Values
Do not use KeyPaths that are subject to change
Often Caused by snapshotting multiple MSIs that install the same files, usually a prerequisite (VBA, MDAC)
Entry in InstallExecuteSequence table with a condition of UserSID <> S-1-5-18 Make the Advertised Shortcut use a per-user keypath Make a Transform if you need it to go elsewhere
Questions!
How do you handle non-roaming environment w/ profile on the network?
Script knows not to overwrite or file-based keypath
Websites
AppDeploy - http://www.appdeploy.com/ Sysinternals - http://technet.microsoft.com/en-us/sysinternals/ Eval Admin Studio - http://www.acresso.com/downloads/downloads_4886.htm LUA Buglight http://blogs.msdn.com/aaron_margosis/archive/2006/08/07/LuaBuglight.aspx MSI Examples - http://msdn.microsoft.com/en-us/library/aa372837(VS.85).aspx WiX - http://wix.sourceforge.net/ WiX Tutorial - http://www.tramontana.co.hu/wix/ MAKEMSI - http://dennisbareis.com/makemsi.htm MSI Basics - http://makemsimanual.dennisbareis.com/windows_installer_basics.htm MSI Reference - http://msdn.microsoft.com/en-us/library/aa372860(VS.85).aspx Installsite - http://www.installsite.org/ Altiris Packaging site - http://juice.altiris.com/packaging MSI Blogger - http://msiblogger.com/
Questions?