Question: How can I export Active Directory Group members? Also, if there are sub-groups , how can I view the sub group members?
Answer: To access the Active Directory through Powershell, an efficient method is to install the Active Directory Module for Powershell .
The Get-ADGroupMember module gets the Active Directory Group members
Import-Module ActiveDirectory Get-ADGroupMember -identity “Group name” | select name | Export-csv -path C:\ADGroupmembers.csv –NoTypeInformation
If there are nested groups , within the group you’re checking , then use the –recursive parameter.
The –recursive parameter will enable an iteration of all the nested groups , reporting on the members. The nested group members are added to the result list
Get-ADGroupMember -identity “Group name” -recursive | select name | Export-csv -path C:\ADGroupmembers.csv –NoTypeInformation