Monday, September 18, 2006

One of the things I have been introduced to over the last few months at work is extreme programming. One of the key concepts in extreme programming is 10 minute deployments. So with this in mind I set out to automate most if not all of the deployment packages for each server.

One of the servers for this project has a number of web services and keeping these up to date used to take 15 minutes. If any typos were made during the installation process it would then take me another 5-10 minutes to figure out that indeed a typo caused the entire problem.

I created a batch file and decided to use the msiexec command line utility to uninstall and install my application. Here is a list of the command line commands for misexec. You can get these yourself by typing msiexec in a command window.

Windows ® Installer. V 3.01.4000.1823
msiexec /Option [Optional Parameter]
Install Options

Installs or configures a product
/a
Administrative install - Installs a product on the network
/j [/t ] [/g ]
Advertises a product - m to all users, u to current user

Uninstalls the product
Display Options
/quiet
Quiet mode, no user interaction
/passive
Unattended mode - progress bar only
/q[nbrf]
Sets user interface level
n - No UI
b - Basic UI
r - Reduced UI
f - Full UI (default)
/help
Help information
Restart Options
/norestart
Do not restart after the installation is complete
/promptrestart
Prompts the user for restart if necessary
/forcerestart
Always restart the computer after installation
Logging Options
/l[iwearucmopvx+!*]
i - Status messages
w - Nonfatal warnings
e - All error messages
a - Start up of actions
r - Action-specific records
u - User requests
c - Initial UI parameters
m - Out-of-memory or fatal exit information
o - Out-of-disk-space messages
p - Terminal properties
v - Verbose output
x - Extra debugging information
+ - Append to existing log file
! - Flush each line to the log
* - Log all information, except for v and x options
/log
Equivalent of /l*
Update Options
/update [;Update2.msp]
Applies update(s)
/uninstall [;Update2.msp] /package
Remove update(s) for a product
Repair Options
/f[pecmsodauv]
Repairs a product
p - only if file is missing
o - if file is missing or an older version is installed (default)
e - if file is missing or an equal or older version is installed
d - if file is missing or a different version is installed
c - if file is missing or checksum does not match the calculated value
a - forces all files to be reinstalled
u - all required user-specific registry entries (default)
m - all required computer-specific registry entries (default)
s - all existing shortcuts (default)
v - runs from source and recaches local package
Setting Public Properties
[PROPERTY=PropertyValue]
Consult the Windows ® Installer SDK for additional documentation on the
command line syntax.
Copyright © Microsoft Corporation. All rights reserved.
Portions of this software are based in part on the work of the Independent JPEG Group.

As you can see there are a number of parameters that can be used. I will discuss just the ones I used in my batch file you can experiment with the the rest yourself. The first thing I did was to uninstall the current packages using this command for each MSI.

msiexec /x {803D4FBB-E1C2-499A-8F9C-6FD5287229D0} /quiet /passive /log "c:\lInstall.txt"


  • /x uninstall the product. I decided to use the product key instead of the application name. I couldn't get the product name to work as a parameter.
  • When getting the product ID look at the properties for your installation project and you will see a Product Code property you can use this value.
  • /quiet - No user interaction
  • /Passive -Unattended mode - progress bar only
  • /log - I logged the installation just in case something happend and I could go back and look.
Installation your MSI.

msiexec ALLUSERS=1 SQL_LOCALHOST=ServerName DIR_ADDRESS="LDAP://OU=MyBusiness,DC=Company,DC=com" PROPERTY_LOCALHOST="Server Name" /i %CommonService% /quiet /passive

In order to get this to work you must configure your installation application to accept command line defaults. Otherwise the properties you pass from the batch file will never be used.

  • In your user interface screens were you define the UI to accept user input just add the [PROPERTY] to the value portion of the UI.\

Here is a an example of a text valuet that I wanted to default to the SQL_LOCALHOST from the batch command line.

Property Sheet in the Installation solution

  • Edit1Label - SQL Server - Title for the label
  • Edit1Property - SQL_LOCALHOST
  • Edit1value - [SQL_LOCALHOST] - Remeber the name must be in brackets.

  • ALLUSERS =1 . If this is set to one the the installation will be for all users instead of the current user.
  • SQL_LOCALHOST=ServerName - each parameter with default values.
  • /i - install - and then your path to the msi. I put mine in a varaible so different developers could change it qickly.
  • /quiet - No user interaction
    /Passive -Unattended mode - progress bar only

and thats all there is to it.

Tuesday, September 12, 2006

Welcome to my blog. Here you will find postings related to many development topics. Here is just a few topics coming up in the next little while.

  • One touch installation
  • Optimizing infopath
  • Web Service Caching techniques.