My adventures including my career (Web development and SharePoint), and my other interests (my family, arduino, Iot) and….

Month: November 2011

While part of recent SharePoint 2007 to SharePoint 2010 migration project, the testers were validating the population of SharePoint security groups. However, they did not have the tools to see the members of a particular Active Directory or tools to match match an obfuscated user name to an individual with a known name. It presented a problem.

A little appropriation from other scripts found on the interwebs and about 20 minutes into something that allows for quick usage to translate an obfuscated user name (n82l2ldf90) into a display name and see what Active Directory groups they are part of as well as entering a group name and seeing quickly who in a member of that group.

It does support the wildcard syntax that is built into the DirectorySearcher object. The magic happens on line 4 which basically says, show me all the things in AD, that have a cn property or a sAMAccountName property that matches the value provided on the command line as argument 1. The following is some sample output showing the output when searching for a user and when searching for a group: