I’m often asked if I can include attributes from a user’s Terminal Services Profile tab in their AD properties in AD Info and AD Tidy, but for whatever reason MS decided to store these attributes in a very strange format so it is not easy. I’ve finally spent some time on it and got something working now and thought I would share my results (and frustration) with the rest of the community in case it helps anyone else out.
Archives For VB.NET – Active Directory
This is a video showing how I created a program that someone recently requested, hopefully if people find these development diary style videos interesting then I will do more as I make more programs (so please let me know what you think!).
For any .NET developers writing programs that require a user to select a container or OU from Active Directory, I’ve made an easy to use dialog window that will show the domain tree and let the user select a specific container.
Just thought I would post about this quickly as its an error message that I ran into recently that took me quite a while to figure out. So to save other .NET developers spending ages trying to work out why it was happening like I did, I’ll explain how you can get rid of this rather annoying problem.
Just a quick example of how you can use the System.DirectoryServices.DirectorySearcher class to find deleted objects (that have not yet reached the tombstone time limit) in your Active Directory domain.
If you have ever tried to enumerate all groups that a user is a member of in Active Directory then you have probably found that the standard way of doing this (looking at the user’s MemberOf attribute) does not get the user’s primary group. You probably then found out that the user is ‘joined’ to their primary group by simply having the Relative ID (RID) of the group in their PrimaryGroupID attribute. That’s great and all… but how do we translate that RID into the name of the group? Well I’m sure there are a few ways to do it but here’s the code I came up with:
Here’s an extremely simple application that will query Active Directory for a user’s full name when given their username.
Here is a control I made that shows Active Directory objects. It inherits from the TreeView control and can be used to show AD objects for user selection in your program. You basically just pass it an LDAP path to the location in your Active Directory that you want it to use as the ‘root’ of the object tree and it does the rest.
The code below will search an Active Directory container/OU for a specified group and will then loop through the members of that group and add each user’s name to a listbox: