Trying to return a set of CSV files based on group members in Active Directory. Unfortunately this command doesn't look at the groups within the group. ie. HW (Global Security) contains groups like Denver_HW, and Aurora_HW. But the command I am using is not returning the nested groups' members.
I have about 200 groups to go through, and I am satisfied with the results from the following command:
get-qaduser -memberof GroupName | select firstname, lastname, description, samaccountname, userprincipalname | export-csv c:\groupname.csv
Option 1. I want to query AD for all groups, enumerate members in the group and export results to a file called c:\groupname.csv
From there I will manually cut and paste members from Aurora_HW and Denver_HW into the main HW csv.
Option 2 (preferred) Enumerate all members within the top level groups to include members of nested group and export those results to .csv
So if I enumerate HW, it will automatically get everyone from HW, Aurora_HW, and Denver_HW and export it to a file called HW.csv
Then if I enumerate SA it will automatically get everyone from SA, Aurora_SA, and Denver_SA and export it to a file called SA.csv |