Populate Distribution group with get-recipient query not working

Home Forums Messaging Software Exchange 2007 / 2010 / 2013 Populate Distribution group with get-recipient query not working

Viewing 1 post (of 1 total)
  • Author
  • Avatar

    I have various recipients that are members of the “Board” group in my Exchange organization. Those recipients are not all Exchange mailboxes. Most of them are simple recipient objects that point to external addresses. However, each object that is related to a board member has “Board” in their “Department” field.

    I want to populate the Board distribution group with those members. I worked out this script (which took an embarrassingly long time — I’m not as familiar with PowerShell as I should be):

    get-recipient -filter {department -eq “board”} | Add-DistributionGroupMember -Identity “Board Group”

    But I get the following error once for each recipient object that is returned by the get-recipient cmdlet:

    Add-DistributionGroupMember : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
    At line:1 char:77
    + get-recipient -filter {department -eq “board”} | Add-DistributionGroupMember < <<< -Identity "Board Group"

    I suspect that it’s because the -Identity parameter isn’t supplied in Add-DistributionGroupMember and that is where I’m hung up. Not sure how to inlcude the -identity paramter and iterate through each recipient that is in the “Board” department. I suspect some kind of clever for each statement, but haven’t gotten proficient enough at PowerShell to figure out how or where to do that.

    Searching on the web for that error message related to the Add-DistributionGroupMember cmdlet brings back little, but a Petri thread is among the returns (no surprise). One of the solutions was to export the desired list of people to a CSV file and then import that CSV file into the group. I’ll give that a go, but I’d rather know why I can’t pipe my get-recipient returns into Add-DistributionGroupMember. Any ideas?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.