Comments on: Getting Exchange Online Distribution List Membership Counts with PowerShell https://practical365.com/getting-exchange-online-distribution-list-membership-counts-with-powershell/ Practical Office 365 News, Tips, and Tutorials Thu, 23 Mar 2023 01:01:18 +0000 hourly 1 https://wordpress.org/?v=6.3.2 By: Finn https://practical365.com/getting-exchange-online-distribution-list-membership-counts-with-powershell/#comment-257149 Thu, 23 Mar 2023 01:01:18 +0000 https://practical365.com/?p=51966#comment-257149 • In my own Outlook Online if I address a new email to the distribution group and click the “+” to expand the group, I can see the user has been removed from the group ✅ • In my own Outlook Online if I switch from email view to “People” view and open the distribution list and look at the members, I can still see the old user in the list!!❌ Why is the Office365 Outlook Online expanded group different to that same group's list of members in the People section?]]> Off topic a little, sorry, but this is related and very interesting. We have Office365, we used M365 as our Exchange server, and we have AD Connect synching our local AD with Azure AD. If I use AD to remove a user from a local, old fashioned AD distribution group (not a dynamic one) and then wait and confirmed that an AD Connect synch has taken place, I get this issue when I look to see what actually updates:

• In “Exchange Admin Center”, I can confirm the user has been removed from the Distribution List ✅
• In my own Outlook Online if I address a new email to the distribution group and click the “+” to expand the group, I can see the user has been removed from the group ✅
• In my own Outlook Online if I switch from email view to “People” view and open the distribution list and look at the members, I can still see the old user in the list!!❌

Why is the Office365 Outlook Online expanded group different to that same group’s list of members in the People section?

]]>
By: Tony Redmond https://practical365.com/getting-exchange-online-distribution-list-membership-counts-with-powershell/#comment-248106 Fri, 09 Dec 2022 17:11:44 +0000 https://practical365.com/?p=51966#comment-248106 In reply to Dan V.

The data that you want is in the AcceptMessagesOnlyFromSendersOrMembers property of a DL. So, you need to retrieve that information and output it in the report. The data is an array, so you probably want to expand the individual members and create a string containing their display names.

]]>
By: Dan V https://practical365.com/getting-exchange-online-distribution-list-membership-counts-with-powershell/#comment-248105 Fri, 09 Dec 2022 16:55:46 +0000 https://practical365.com/?p=51966#comment-248105 How can I add the “Senders who don’t require message approval:” information to this report.

]]>
By: Tony Redmond https://practical365.com/getting-exchange-online-distribution-list-membership-counts-with-powershell/#comment-238510 Tue, 17 May 2022 10:05:08 +0000 https://practical365.com/?p=51966#comment-238510 In reply to Alex.

If you can identify the problematic DL, you might be able to run the code interactively to find where the problem is… and if you report it here, we will see what we can do.

]]>
By: Alex https://practical365.com/getting-exchange-online-distribution-list-membership-counts-with-powershell/#comment-238509 Tue, 17 May 2022 08:41:44 +0000 https://practical365.com/?p=51966#comment-238509 In reply to Tony Redmond.

Thank you for the reply.
I suppose I do. I will try to debug it. Thank you.

]]>
By: Tony Redmond https://practical365.com/getting-exchange-online-distribution-list-membership-counts-with-powershell/#comment-238498 Mon, 16 May 2022 15:34:09 +0000 https://practical365.com/?p=51966#comment-238498 In reply to Alex.

Do you have any distribution lists that are nested more than 3 deep? That might be the reason (based on the reference to call depth).

Apart from that, I have no idea. I can’t debug PowerShell remotely… but you can debug the code on your tenant…

]]>
By: Alex https://practical365.com/getting-exchange-online-distribution-list-membership-counts-with-powershell/#comment-238497 Mon, 16 May 2022 15:28:31 +0000 https://practical365.com/?p=51966#comment-238497 Hi,
When I run the script I’m getting the following error in the end of groups processing:

The script failed due to call depth overflow.
+ CategoryInfo : InvalidOperation: (0:Int32) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : CallDepthOverflow

I tried to change the name of the file, but it didn’t help. Any ideas?

]]>
By: Tony Redmond https://practical365.com/getting-exchange-online-distribution-list-membership-counts-with-powershell/#comment-237699 Tue, 08 Feb 2022 09:48:33 +0000 https://practical365.com/?p=51966#comment-237699 In reply to Francesco S.

Change the line which removes duplications from DL members to:

$MembersNames = $MembersNames | Sort MemberId -Unique | Sort MemberName

]]>
By: Francesco S https://practical365.com/getting-exchange-online-distribution-list-membership-counts-with-powershell/#comment-237698 Tue, 08 Feb 2022 09:14:53 +0000 https://practical365.com/?p=51966#comment-237698 In reply to Tony Redmond.

Thank you for that!
My apologies, I was looking into the other powershell script (ReportDLMembershipsCountsGraph) and I noticed that the “Sort-Object DisplayName” doesn’t work for the DL members names.

$Uri = “https://graph.microsoft.com/v1.0/groups/” + $DL.ExternalDirectoryObjectId + “/transitiveMembers”
[array]$Members = Get-GraphData -AccessToken $Token -Uri $uri | Sort-Object DisplayName

When I run the script, I don’t get any error message but the names are all messed up. Am I missing something? Is there a way to sort both the members and the managers names in that script?

Many thanks in advance

]]>
By: Tony Redmond https://practical365.com/getting-exchange-online-distribution-list-membership-counts-with-powershell/#comment-237675 Fri, 04 Feb 2022 16:26:43 +0000 https://practical365.com/?p=51966#comment-237675 In reply to Francesco S.

It’s PowerShell, so you can sort as you like. To sort the members of a DL by their display name, add a Sort command after the members are fetched. For instance:

[array]$Members = Get-AzureADGroup -ObjectId $DL.ExternalDirectoryObjectId | Get-RecursiveAzureAdGroupMemberUsers | Sort DisplayName

]]>