locked
get Distribution Group owners - diffrent result from exchange shell RRS feed

  • Question

  • I use this script to get me all owners of a distribution group ( name , email , windows login name )
    (Get-DistributionGroup zakos@domain.com).managedby | % { Get-Recipient $_.DistinguishedName | Select DisplayName, PrimarySmtpAddress, samaccountname }
    in exchange shell , I get what I want , but when I run this script in powershell ( after loading exchange shell ofcourse) I get something else , and much bigger result.

    any suggestion ?

    • Edited by Zakos Wednesday, July 2, 2014 10:47 AM
    Wednesday, July 2, 2014 10:47 AM

Answers

  • Hi,

    I have a test in my environment using Exchange 2010. When running the following cmdlet on EMS, it will display the right result. But if running it in PowerShell, it will return all the mailboxes, not the owner information of this distribution group.

    (Get-DistributionGroup dis1@nourd.com).managedby | % { Get-Recipient $_.DistinguishedName | Select DisplayName, PrimarySmtpAddress, samaccountname }

    In order to get an accurate result, I recommend you run the above cmdlet on EMS.

    Hope it helps.

    Best regards,


    Amy Wang
    TechNet Community Support

    Thursday, July 3, 2014 6:32 AM
    Moderator

All replies

  • Hi,

    I have a test in my environment using Exchange 2010. When running the following cmdlet on EMS, it will display the right result. But if running it in PowerShell, it will return all the mailboxes, not the owner information of this distribution group.

    (Get-DistributionGroup dis1@nourd.com).managedby | % { Get-Recipient $_.DistinguishedName | Select DisplayName, PrimarySmtpAddress, samaccountname }

    In order to get an accurate result, I recommend you run the above cmdlet on EMS.

    Hope it helps.

    Best regards,


    Amy Wang
    TechNet Community Support

    Thursday, July 3, 2014 6:32 AM
    Moderator
  • Hi  , thanks for the reply,
    I have to run on powershell , therefore i have this 'problem' , because I run  C# which run powershell which load exchange shell into it :)
    Thursday, July 3, 2014 7:47 AM