I'm trying to export group members and their properties from groups with names starting with XX so the output is
With the code i wrote i can get all the users and properties but i would also like to export the group in front of each member
$Groups = Get-ADGroup -filter {name -like "Group*"} | Select-Object Name
foreach ($Group in $Groups)
{
$Members = Get-ADGroupMember -Identity $($Group.name) -Recursive | Select-Object name
foreach ($Member in $Members )
{ Get-ADUser -Identity $($Member.name) -Properties * | Select-object * | export-csv
}
}
Thank you in advance, guys.