Setup Factory for Windows Installer

Per-Machine vs. Per-User Installations

The Windows Installer allows you to perform an install on a per-user or per-machine basis. What this mostly affects is the value of certain folder properties at install time such as the DesktopFolder property, ProgramMenuFolder property, StartMenuFolder property, and StartupFolder property. Whether these values are the per-machine or per-user values is determined by the ALLUSERS property.

When the ALLUSERS property is undefined (or set to "") it means that the installation should set those folders to the per-user (a.k.a. "user profile") values. If ALLUSERS is set to 1 the install expands those paths to the per-machine (a.k.a. "all users profile") values. If ALLUSERS is set to 2, the installer tries to first set the value to 1 if the user running the install has administrative privileges or to empty ("") if the user is not logged in with administrative privileges.

Note that on Windows Vista under UAC, when ALLUSERS is 2 it will get set to 1 even if the user is logged in with only user privileges.

Best Practices

In general, you should configure your installers to be "per-machine" installs (i.e. ALLUSERS=1). You should only use per-user installs (i.e. ALLUSERS="") if your installer meets the following conditions:

1. All files are guaranteed to be installed to per-user folders. Most installers allow the user to choose the install location and default to ProgramFilesFolder which disqualifies them from this requirement.

2. There are not any changes being made to machine-wide Registry keys such as HKEY_LOCAL_MACHINE, HKEY_CLASSES_ROOT, etc.

3. There are not any other files or folders affected by the installation that are not in per-user locations.

If your installer does meet that criteria, you should also set the "Privileges required" value on the Package tab of the Project Settings screen to Limited so that the Windows Installer engine does not force a UAC elevation to take place once installation is about to begin.

Having said all of that, in practice it is very rare to design and deploy a per-user installation. In general, you should keep your installers as per-machine installs.

Problems Caused by Per-User Installations

There are several common scenarios that an arise when the choice of per-user vs per-machine is given to the user:

1. Major Upgrades can Fail

If you use the Upgrade code feature of Windows Installer to perform a major upgrade the detection of the existing software will fail if: (a) the original software was installed with ALLUSERS="" and the new software has ALLUSERS=1 in its Property table or passed on the command line or (b) the original software was installed with ALLUSERS=1 and the new software has ALLUSERS="" or ALLUSERS is not defined in the Property table or on the command line.

2. Uninstall Problems

If two different users on the system install the software with ALLUSERS="" they will both have their own shortcuts and Add/Remove Programs entries made (which is fine and is by design). However, if some of the files are installed to a shared location (such as ProgramFilesFolder) and one of the users uninstalls the software, the other user will not be able to use the software even though their shortcuts and Add/Remove Programs entries are still intact. In other words, the two installed instances of the software will not "know" about each other.

How to Ensure a Per-Machine Installation

When using Setup Factory for Windows Installer, here is how you can do everything that you can to ensure a per-machine installation:

1. Set ALLUSERS to 1.

Do this by Selecting Project > Settings from the menu and going to the Properties tab. Ensure that there is an entry for ALLUSERS and it is set to 1. If it is not there, add it.

2. Do not include the "UserProfileDlg" dialog.

Open the Dialogs dialog by selecting Project > Dialogs from the menu. Ensure that the UserProfileDlg dialog is not in your list. If it is, remove it.

The steps above will help ensure a per-machine installation, but they cannot guarantee it because the user running the installation can override the value on the command line or by editing the .MSI file.

More Information

MSDN Online: ALLUSERS Property

MSDN Online: Per-machine Installations

MSDN Online: Per-user Installations

MSDN Online: Specifying a Per-User or Per-Machine Installation