Adding an existing user to a new group
If you'd like to give an existing user access to your software, you'll need a way to reference their account and then add it to the group you're creating. For example, user Alice already exists on the system and you'd like to add her to a new group called Supervisors
. As a side note, you would typically ask for that username through a UI wizard. Then, save the username to a WiX property. Properties can be accessed in other elements by using a square bracket notation, as follows:
<util:User Id="myNewUser" Name="[USERNAME]" />
The UtilExtension namespace doesn't include an element to create a new group. So, we'll return to Community MSI Extensions. In this recipe, we'll locate an existing user account and add it to our Supervisors
group.
Getting ready
To prepare for this recipe, create a new setup project and call it AddExistingUserToGroupInstaller
.
How to do it...
Use the elements from UserPrivilegesExtension
to find an existing user and add it to a...