Creating a local user
There are plenty of times when you'll want to add a new user account for your software to use. For example, a Windows service can be run as a user whose password never expires and has access to only the parts of the system needed by your software. The same goes for a website in IIS. You must decide which user these long-running processes will run as, but they'll typically it will be a service account that only the machine interacts with. Our installer can set up a new local user on the target machine for exactly this purpose.
Note
When I say local user, I am referring to an account that is local to the target computer and not a domain user or a Microsoft Live account.
Getting ready
To prepare for this recipe, create a new setup project and name it NewUserInstaller
.
How to do it...
A User
element from the UtilExtension
namespace can be used to create a local user account, as shown in the following steps:
Add
UtilExtension
to the project by right-clicking on the References node...