Reputation: 16825
Non-admin user should have ability to install an application.
That's why I set InstallScope in the installation to "perUser" by default.
But sometimes Admin should have ability to install this application per machine and all user should have access to the same application.
Is it possible to install the same application either per user or per machine?
For example depending on some command line property?
I use following wxs to build my test msi package:
<Package Id="*" InstallScope="perUser"
InstallPrivileges="limited"
InstallerVersion="100"
Keywords="Installer"
Description="TestApp Installer"
Compressed="yes"/>
<MediaTemplate EmbedCab="yes"/>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="LocalAppDataFolder" Name="AppData">
<Directory Id="INSTALLDIR" Name="TestApp">
<Component Id="app.exe" Guid="AD5A8A90-7137-4F71-ABC5-A75D98CA0290">
<File Id="app.exe" Source="..\server\app.exe" />
<RemoveFolder Id="TestApp" On="uninstall" />
<RegistryKey Root="HKCU" Key="Software\TestManufactorer\TestApp">
<RegistryValue Name="app.exe" Value="1" KeyPath="yes" Type="integer" />
</RegistryKey>
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="Complete" Title="TestApp" Display="expand" Level="1" ConfigurableDirectory="INSTALLDIR">
<Feature Id="MainProgram" Title="Program" Description="The main executable." Level="1">
<ComponentRef Id="app.exe" />
</Feature>
</Feature>
</Product>
</Wix>
If it is possible to install the same application either per user or per machine - what should be changed in this example?
Upvotes: 3
Views: 4461
Reputation: 55601
This is meant to answer a broader unspoken question. :)
Here is my $.02 on the topic:
Think very, very long before doing this.
Per-User installations are very difficult to manage. (Rule 30: Per-machine Installs are Easier to Manage )
Because per-machine packages are installed for every user, there are fewer problems for subsequent repair, patching and uninstall. For example, if a user installs an application only for themselves, another user (even an administrator) cannot later uninstall the application.
I work in an enterprise IT environment with automated software deployment and software that was installed per-user just wrecks everything all up. This model of deployment is meant for 'viral' (socially spread) applications where the user installs software without needing admin permissions. Guess what? WE DON'T WANT THAT! We do everything possible to get rid of user installed software.
The only people who benefit from per-user/per-machine software are companies that have a business plan that wants to upset the market through social mechanisms and then "grow up" into being a corporate application supporting per-machine. One example of this is Google Chrome.
Is this you? Then read the links below and go for it. You'll have to translate this into WiX schema.
If not, don't do it. Just go Per-Machine and keep your life easy.
Authoring a single package for Per-User or Per-Machine Installation context in Windows 7
Upvotes: 1