Exchange Server TechCenter > Exchange Server Forums > General Discussions > Get the list of members in "Dynamic distribution group"

Answered Get the list of members in "Dynamic distribution group"

  • Wednesday, February 03, 2010 4:50 AM
     
     
    Hi,

    How to get the list of group members in "Dynamic Distribution Group" with their Primary smtp address.

    Senthil KR

Answers

  • Wednesday, February 03, 2010 9:38 AM
    Moderator
     
     Answered
    Hi Rajnish,

    Thanks for reply.

    Need to export list of members with their primary smtp address for existing "Query based group mail id".

    I use the following shell command to export the same.

    $members = Get-DynamicDistributionGroup -Identity "dynamicgroupname"
    Get-Recipient -RecipientPreviewFilter $members.RecipientFilter > membersall.txt

    It gives me the list of members with their name. I need their email address. Please help me in this.

    where as i've tried your suggestion in ADUC. Its not listing the members. I get only empty excel sheet with columns " Name, Type & Descrption".

    Regards,

    Senthil KR
    Hi Senthil,
    Add this "| select Displayname,PrimarySmtpAddress"

    $members = Get-DynamicDistributionGroup -Identity "dynamicgroupname"
    Get-Recipient -RecipientPreviewFilter $members.RecipientFilter | select Displayname,PrimarySmtpAddress > membersall.txt


    Frank Wang
    • Marked As Answer by Senthil KR Wednesday, February 03, 2010 10:45 AM
    •  

All Replies

  • Wednesday, February 03, 2010 4:56 AM
     
     
    Senthil, Try this

    This can be done from ADUC , where as you can create a query to get all the users and then from add and remove coloumn , you can add email address and then export the list to a csv file.

    If you have the Saved query folder in teh Active Directory Users and computers Snap-in then you can do this:

    1. Right-Click the folder and select New query
    2. Give it a descriptive name
    3. Click Define Query
    4. From the drop down list select Custom Search
    5. Clcik Advanced tab
    6. Paste in the following:

    (&(objectCategory=user)(memberOf=cn=Domain Admins,cn=users,dc=YourDomain,dc=local))

    You will need to change the cn=..... part to suite your groups distinguished name.

    then once you save this and get a list you can:
    7. Right-click on your query
    8. Select Export List (not Export Query definition as this just creates a backup of the query)
    9. Select from the save as type:
       Text (Comma Delimited) (*.csv)
    Which of course, opens in Excel as it is.

    Raj
  • Wednesday, February 03, 2010 5:44 AM
     
     
    Hi Rajnish,

    Thanks for reply.

    Need to export list of members with their primary smtp address for existing "Query based group mail id".

    I use the following shell command to export the same.

    $members = Get-DynamicDistributionGroup -Identity "dynamicgroupname"
    Get-Recipient -RecipientPreviewFilter $members.RecipientFilter > membersall.txt

    It gives me the list of members with their name. I need their email address. Please help me in this.

    where as i've tried your suggestion in ADUC. Its not listing the members. I get only empty excel sheet with columns " Name, Type & Descrption".

    Regards,

    Senthil KR
  • Wednesday, February 03, 2010 5:59 AM
     
     
    You need add the coloumn and then add the email addresses from there. By default it will always show the above three fields.
    Raj
  • Wednesday, February 03, 2010 7:44 AM
     
     
    How can i add the column and where?

    Senthil KR
  • Wednesday, February 03, 2010 8:50 AM
     
     
    Check this script if this helps   http://exchangepedia.com/blog/2005/09/how-to-export-all-email-addresses-from.html


    For adding email address coloumn, go to ADUC, Click on view , add/remove coloumn and then scroll down to email address and add it.
    Raj
  • Wednesday, February 03, 2010 9:38 AM
    Moderator
     
     Answered
    Hi Rajnish,

    Thanks for reply.

    Need to export list of members with their primary smtp address for existing "Query based group mail id".

    I use the following shell command to export the same.

    $members = Get-DynamicDistributionGroup -Identity "dynamicgroupname"
    Get-Recipient -RecipientPreviewFilter $members.RecipientFilter > membersall.txt

    It gives me the list of members with their name. I need their email address. Please help me in this.

    where as i've tried your suggestion in ADUC. Its not listing the members. I get only empty excel sheet with columns " Name, Type & Descrption".

    Regards,

    Senthil KR
    Hi Senthil,
    Add this "| select Displayname,PrimarySmtpAddress"

    $members = Get-DynamicDistributionGroup -Identity "dynamicgroupname"
    Get-Recipient -RecipientPreviewFilter $members.RecipientFilter | select Displayname,PrimarySmtpAddress > membersall.txt


    Frank Wang
    • Marked As Answer by Senthil KR Wednesday, February 03, 2010 10:45 AM
    •  
  • Wednesday, February 03, 2010 10:45 AM
     
     
    Thanks Frank...

    Its working fine.

    Great work...


    Senthil KR
  • Saturday, May 08, 2010 11:08 AM
     
     
    aaaarghhh.......This has been of tremendous help.Great work Frank.Wang
  • Tuesday, July 27, 2010 1:40 AM
     
     

    Senthil i think you are getting full list of users in your exchange organization.... it is not filtered...check your resultset.

     

     

     

     


    sanjay
  • Sunday, July 24, 2011 8:32 AM
     
     

    I get this error in Powershell

    Get-Recipient : Cannot validate argument on parameter 'RecipientPreviewFilter'.
     The argument is null or empty. Supply an argument that is not null or empty an
    d then try the command again.
    At line:1 char:108
    + $members = Get-DynamicDistributionGroup -Identity "GroupName" | Get-Rec
    ipient -RecipientPreviewFilter <<<<  $members.RecipientFilter > membersall.txt
        + CategoryInfo          : InvalidData: (:) [Get-Recipient], ParameterBindi
       ngValidationException
        + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Excha
       nge.Management.RecipientTasks.GetRecipient


    We have populated the members of the Distribution group using a custom attibute.

    Any idea what we might be doing wrong while running the command

  • Sunday, July 24, 2011 4:07 PM
     
     
    On Sun, 24 Jul 2011 08:32:14 +0000, Kitaab wrote:
     
    >
    >
    >I get this error in Powershell
    >
    >Get-Recipient : Cannot validate argument on parameter 'RecipientPreviewFilter'. The argument is null or empty. Supply an argument that is not null or empty an d then try the command again. At line:1 char:108 + $members = Get-DynamicDistributionGroup -Identity "GroupName" | Get-Rec ipient -RecipientPreviewFilter <<<< $members.RecipientFilter > membersall.txt + CategoryInfo : InvalidData: (:) [Get-Recipient], ParameterBindi ngValidationException + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Excha nge.Management.RecipientTasks.GetRecipient
    >
    >We have populated the members of the Distribution group using a custom attibute.
    >
    >Any idea what we might be doing wrong while running the command
     
    You're piping the results of the get-dynamicdistributiongroup into the
    get-recipient. Then you're trying to use an undefined "$members"
    variable.
     
    Two separate statements will work:
    $members = Get-DynamicDistributionGroup -Identity "GroupName"
    Get-Recipient -RecipientPreviewFilter $members.recipientpreviewfilter
     
    If you want them on one line, separate them with a semicolon.
     
    ---
    Rich Matheisen
    MCSE+I, Exchange MVP
     

    --- Rich Matheisen MCSE+I, Exchange MVP