Friday, 21 May 2010

Programmatically grant user privileges

When installing services, in particular SQL Server, it is a frequent requirement to create a service user and assign certain rights. To assist users during installation it is helpful to gather the required information (e.g. username + password) amd programmatically create the user for them. To achieve this you will need to create the user, assign it to the appropriate groups and grant any specific rights. Granting privileges and impersonation is covered in Corinna John's CodeProject article: http://www.codeproject.com/KB/cs/lsadotnet.aspx
How to add a user to the local system using C#: http://support.microsoft.com/kb/306273
How to add a user to the domain using C#: http://en.csharp-online.net/User_Management_with_Active_Directory%E2%80%94Creating_Users

No comments: