Pulling a list of group members from multiple security group in AD


I’m new to PowerShell and have picked up a few bits, but need to some help if possible.

I’ve created a list of AD groups, which I need to pull the members of for audit purposes. The groups list is in a txt file, but I don’t know how to get powershell to use this list to allow me to pull the members of each group listed and export them to a CSV file.

I need to include the name of the group and the name of the group member as a minimum.

If anyone is able to help, I’d really appreciate it.

To read group names from txt file use Get-Content cmdlet

To get group members use Get-ADGroupMember cmdlet of the ActiveDirectory PowerShell module…