I had to write some quick code for a project at work where I needed to audit a group of users and confirm if the user appeared in a predefined Active Directory group. There are a number of examples online, and I read some interesting approaches from authors at:
- Find what Active Directory groups a user is in
- Create a SQL Server view of your Active Directory users
- How to: (Almost) Everything in Active Directory via C#
- Searching the Directory
- Quick List for C# Code Examples
Below is a an early release of what I ended up using. Feedback if any would be appreciated.
[snippet slug=check-user-member-active-directory-group lang=bsh]