User Profile
filzah
Copper Contributor
Joined Jun 16, 2021
User Widgets
Recent Discussions
Export members for a list of security groups from AAD
Hi. I need to download the members of 1000 security groups in AAD. Can I export members (name, email, upn) for a specific list of security groups with name begins with 'FP3' or from a csv file? Tried using the PS command from this https://docs.microsoft.com/en-us/answers/questions/139633/powershell-script-to-export-all-azure-ad-groups-st-1.html but the script seems incorrect as line 3 is asking to key just one security group. Tried using wildcard, FP3* but doesn't seem to work too. Thanks in advanced.9.2KViews1like8CommentsRe: Export members for a list of security groups from AAD
Hi Schnittlauch Thanks so much for replying. Almost there! I used the code below but somehow the results are incomplete. Would you know why and how I can rectify this? Connect-AzureAD $groups=Get-AzureADGroup -SearchString FP3_Share_IS_ $resultsarray =@() ForEach ($group in $groups){ $members = Get-AzureADGroupMember -ObjectId $group.ObjectId -All $true ForEach ($member in $members){ $UserObject = new-object PSObject $UserObject | add-member -membertype NoteProperty -name "Group Name" -Value $group.DisplayName $UserObject | add-member -membertype NoteProperty -name "Member Name" -Value $member.DisplayName $UserObject | add-member -membertype NoteProperty -name "ObjType" -Value $member.ObjectType $UserObject | add-member -membertype NoteProperty -name "UserType" -Value $member.UserType $UserObject | add-member -membertype NoteProperty -name "UserPrinicpalName" -Value $member.UserPrincipalName $resultsarray += $UserObject } } $resultsarray | Export-Csv -Encoding UTF8 -Delimiter ";" -Path "C:\scripts\output.csv" -NoTypeInformation8.6KViews0likes0Comments
Recent Blog Articles
No content to show