First you need to target Windows Installer 4.0 (or later which means 4.5 on pre-Vista platforms) if you want to make a single package which can do per-user & per-machine installations. This will involve bootstrapping the 4.5 redistributable for pre-Vista SP2 platforms. The code you pasted shows you currently targeting Windows Installer 2.0 which will never work & is pretty random anyway as you'd get better results targeting 3.1 if XP is the earliest platform you're supporting.
Second you need to set the ALLUSERS property to 2 & set the MSIINSTALLPERUSER property accordingly (empty for per-machine, 1 for per-user) for Windows Installer 5.0 platforms (Windows 7 & Server 2008 R2) -> http://msdn.microsoft.com/en-us/library/aa367559.aspx That should get you started. Palbinder Sandher Software Platform Engineer T:+44 (0) 141 945 8500 F:+44 (0) 141 945 8501 http://www.iesve.com **Design, Simulate + Innovate with the <Virtual Environment>** Integrated Environmental Solutions Limited. Registered in Scotland No. SC151456 Registered Office - Helix Building, West Of Scotland Science Park, Glasgow G20 0SP Email Disclaimer -----Original Message----- From: Sean Leonard [mailto:lists+sourcefo...@seantek.com] Sent: 08 November 2011 20:26 To: wix-users@lists.sourceforge.net Subject: [WiX-users] Per-Machine and Per-User installs on XP/Vista/7 in the same MSI In WiX 3.5, I am trying to create an MSI that can do both per-machine (ALLUSERS=1) and per-user (ALLUSERS="") installs from the same MSI. In this case, I want the default behavior to be per-machine, unless the user takes explicit steps to install per-user. I read several forum posts (and some of the Microsoft documentation), but they are confusing, or not promising. I am hoping that some ingenious folks here can figure out how to do this! Here is the scenario: Using WixUI_Advanced When double-clicking on the MSI (i.e., msiexec /i path-to-msi.msi, without setting any properties explicitly): On Windows XP: if the user is an administrator (privileged), the default Install button installs per-machine. if the user is not an administrator (not privileged), the default Install button installs per-machine--which will fail. However, clicking the "Advanced" button allows the user to install per-user. On Windows Vista/Windows 7: if the user is an administrator (privileged), AND elevated, the default Install button installs per-machine. (The shield icon may or may not be visible.) if the user is an administrator (privileged), AND NOT elevated, the default Install button installs per-machine. (The shield icon should be visible.) if the user is not an administrator (not privileged), the default Install button installs per-machine--which will require the user to be prompted for an administrator's credentials. (The shield icon should be visible.) However, clicking the "Advanced" button allows the user to install per-user. In all cases, explicitly setting ALLUSERS="" or ALLUSERS=1 at the msiexec command-line will force per-user or per-machine installs. ******** The closest we have gotten thus far is: <Package Id="*" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="limited" ReadOnly="no" Keywords="!(loc.PackageKeywords)" Description="!(loc.PackageDescription)" Comments="!(loc.PackageComments)" /> (And various other supporting WiX elements.) In the configuration above: On Windows XP, the behavior is correct. On Windows Vista/Windows 7: *CORRECT*: if the user is an administrator (privileged), AND elevated, the default Install button installs per-machine. (The shield icon is NOT visible.) *INCORRECT*: if the user is an administrator (privileged), AND NOT elevated, the default Install button installs per-machine. The shield icon is visible. However, the package does NOT elevate. The error given is: "You do not have sufficient privileges to complete this installation for all users of the machine. Log on as administrator and then retry this installation." Error 1925. *INCORRECT*: if the user is not an administrator (not privileged), the default Install button installs per-machine. The shield icon is visible. However, the package does NOT elevate. Same error as above. Clicking the "Advanced" button allows the user to install per-user successfully, without elevation. In all cases, explicitly setting ALLUSERS="" at the command-line performs the intended behavior of forcing per-user installation. ALLUSERS=1 at the command-line has the intended behavior of forcing per-machine installation, but it does NOT force elevation--so per-machine fails on Vista and 7. ******** So basically, is there some way through custom actions or otherwise, to cause an MSI built with InstallPrivileges="limited" to request elevation? Alternatively, is there a way to cause an MSI built with InstallPrivileges="elevated" to reconfigure itself so that it does not request elevation? Thanks all, Sean ------------------------------------------------------------------------------ RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users