Forum Discussion
Check Specific AD Group Membership for list of users
Hello all. I am trying to find a way to have a list of user accounts in users.txt and query that list to see if any of the users are a member of a "Specific" AD Group. I cannot find anything by searching as everything is how to export users from an AD group. So I would like to have a users.txt file with a list of user accounts and then find out if any of those users are members of "GroupA" AD group or not. And if possible export the results in a .csv file. Any help would be GREATLY appreciated as I cannot find anything on this doing my own searches. Many thanks in advance!
- mmancinaBrass Contributor
You could get all the members of the AD group with this command: Get-ADGroupMember (ActiveDirectory) | Microsoft Docs
And the loop through the results and check if the users in the users.txt are in the set of results.