Adding a new user to a new group
A Windows group is a collection of users who have the same permissions, via the group, to a resource. This makes updating permissions easier and also lets us move users from one group to another to change their access. For example, you could add a user to a Supervisors
group to give them full access to your software, including administration utilities; alternatively, you could add them to an Employees
group to restrict their access to only certain files and folders. In this recipe, we'll begin by creating a user and a group and then add that user to the group.
The UtilExtension
namespace that ships with the WiX Toolset offers a lot of functionality around users and groups, but one thing it doesn't have is a way to create a Windows group. For that, we turn to Community MSI Extensions from AppSecInc. There are several extensions in this library, but the one we're after is called UserPrivilegesExtension
. It has elements to create users and groups.