While getting owner of distribution group it returns wrong result

Dharmesh Khatri 0 Reputation points
2024-09-12T13:13:10.7933333+00:00

When I am trying to get distribution group with 1 owners from

Distribution Group Name : Donotedit it has one owner with Name as Aasim_anwar2 but when I get using

Get-Recipient -Identity "aasim_anwar2" | Select-Object DisplayName,PrimarySmtpAddress, Name | Sort-Object Name

It retunes following results:

DisplayName PrimarySmtpAddress Name

----------- -------------------------- ----

aasim_anwar2 aasim_anwar@nmicrosoft.com aasim_anwar

aasim_anwar1edit aasim_anwar2@nmicrosoft.com aasim_anwar2

Above values are wrong. AS Donotedit distribution group have only 1 owner but when i get it. It returns 2 owner name shown above.

PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,466 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Wesley Li 8,345 Reputation points
    2024-09-13T15:25:22.8333333+00:00

    Hello

    It seems like you're encountering an issue where the Get-Recipient command is returning two owners for the "Donotedit" distribution group, even though it should only have one owner. This could be due to a few reasons:

    Duplicate Entries: There might be duplicate entries in the directory for the owner. This can happen if there are synchronization issues or if the owner has been added multiple times with slight variations in their details.

    Display Name Confusion: The display names might be causing confusion. In your case, aasim_anwar2 and aasim_anwar1edit both have similar primary SMTP addresses, which might be leading to the incorrect assumption that there are two different owners.

    Command Syntax: Ensure that the command syntax is correct and that there are no hidden characters or spaces that might be affecting the results.

    To troubleshoot this issue, you can try the following steps:

    Check for Duplicates: Use the Get-Recipient command to check for any duplicate entries for aasim_anwar2. You can use a more specific filter to ensure that you're getting the correct results.

    Verify Owner Details: Double-check the details of the owner in the directory to ensure that there are no discrepancies or duplicate entries.

    Use Exchange Admin Center: If possible, use the Exchange Admin Center to manually verify the owners of the distribution group. This can help you identify any discrepancies that might not be visible through the command line.

    If the issue persists, you might want to consult with your IT department or refer to the Microsoft documentation on managing distribution groups for further assistance.

    0 comments No comments

  2. Rich Matheisen 46,556 Reputation points
    2024-09-13T15:47:59.9233333+00:00

    The "ManagedBy" property of a distribution group is a multi-valued object that contains the distinguishedNames of the group owners.

    I don't have any Exchange organization to check the code below, but I believe it will do what you want.

    (Get-DistribuionGroup -Identity Donotedit).ManagedBy |
    	Foreach-Object{
    		Get-Recipient -Identity $_ |
    			Select-Object DisplayName,PrimarySmtpAddress, Name | 
    				Sort-Object Name
    	}
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.