CustomAddADUser v1.0

I uploaded a new project on Github today, named CustomAddADUser.

If you have a lot of Active Directories and/or employee account records to maintain, or even if you don't but you're just obsessive compulsive like me, you might require a certain level of completeness, accuracy, and use of custom attributes that the old Active Directory Users and Computers doesn't really give you.  For instance, let's say that your HR system requires that you populate the "Employee ID" attribute on your user accounts.  The ADUC GUI doesn't provide that as part of the "new user" dialog. You have to create the user first, then enable "Advanced Features," then go and click on them again, open their properties sheet, go to the "Attribute Editor" tab, and type it in there.  And even then it's still prone to typos, which will make your identity management a struggle and your HR system won't be able to accurately track the user accounts.  You can't just mark the "employeeID" attribute as mandatory unless you want to modify the AD schema. And even if you did that, you still can't ensure that the employee ID matches a very particular ID format that your company uses.

Well CustomAddADUser aims to make all that possible.

Almost everything is customizable via a configuration file, including which attributes are mandatory, the application's icon, the window title, the company logo that appears on the "About" tab, the help text that appears on the About tab, and the regular expressions that are used to validate the input. Furthermore, you'll notice as you enter the user's account details that names are automatically capitalized and trimmed for you, etc., to encourage a clean and consistent user database.

(Gah people that don't capitalize the first letters of names drives me up the wall!)

So let's say that you need all your employees to have their employee ID attributes filled out, and your company uses employee IDs that look like F4348277 for full-time employees, and P4348277 for part time employees.  No problem, just edit the config file to use this regex pattern:

<add key="employeeIDRegex" value="\b[fp]\d{7}\b" />

Now the application will not allow the user to be created until the employee ID matches that regex pattern.  It will politely remind the administrator that the attribute needs to match that pattern.

All the other attributes have their own regex patterns too. If you don't care about the format of the attribute, just leave the regex pattern as (.+) to match anything.

Additionally, since it's very rare that AD users are created and aren't assigned to any security groups, you can easily copy the security group members from another existing user during creation.  When you change the "Create in" drop-down list, the list of available users from which to copy group memberships changes accordingly to show only users who are also in that branch of the directory.

The app is about 36 hours old so I will likely continue adding new features pretty quickly.  And of course, I wouldn't have put it on Github if I wasn't welcoming to anyone who wanted to submit bugs, feature requests, etc.  One of my missions with this application is to make it significantly better than the standard ADUC Users and Computers interface that people might actually want to use it... so I will be adding more features to it.

Comments (3) -

Matt Fippard 12/10/2014 6:11:37 AM

Hi, I'm really interested in being able to use this, however I am unable to compile it. I get an error from line 132
An exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll but was not handled in user code.
Additional information: Cross-thread operation not valid: Control 'createInComboBox' accessed from a thread other than the thread it was created on.

Do you have any ideas as to why this would be occurring?  I have VS2013 Express on windows 8.1 64bit Pro.


Thanks for stopping by.  This is odd... I am compiling it just fine right now, also on Windows 8.1 64 bit, using VS 2013. In addition, I have a couple admins who are using the application all the time on Server 2008 R2 with .NET 4.5.1 installed... If you've already got .NET 4.5.1, I'm not sure what it is!  Frown

The classic problem is that you weren't allowed to access GUI elements from other threads in the program. It's pretty easy to solve with something like void BackgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e), but they seem to have relaxed the restrictions in .NET 4.5.1.

Matt Fippard 12/11/2014 8:29:14 AM

I tried with Invoke and BeginInvoke but my knowledge with C# is very limited so in the end I used the cowards way out and put CheckForIllegalCrosThreadCalls = false in the form initialization. Tool s works lovely like this and as it's only me using it I don't see it being a problem

Comments are closed