Parity123
asked on
Powershell : Group members export
Hello experts,
I have the following script and I need to output the members to a csv file with the format, GroupName, username.
For instance:
Group1, testuser1
Group2,testuser2
Group2,testuser1
$G = Get-AdGroup -filter "name -like 'test*'" -properties samaccountname
foreach ($group in $G) {
get-adgroupmember -identity $G.samaccountname | export-csv ./test.csv
}
Looking forward to your assistance.
I have the following script and I need to output the members to a csv file with the format, GroupName, username.
For instance:
Group1, testuser1
Group2,testuser2
Group2,testuser1
$G = Get-AdGroup -filter "name -like 'test*'" -properties samaccountname
foreach ($group in $G) {
get-adgroupmember -identity $G.samaccountname | export-csv ./test.csv
}
Looking forward to your assistance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER