none
How to use exchagne powershell to create a new DL based upton the users in an old Security group. RRS feed

  • Question

  • Hi

    If this is the wrong forum let me know. We had a recent issue where by we send out an email notification to a DL.

    However some users didn't get the email.  We think it is because they are in a security group which is nested inside the DL.

    We now want to create some new DL's for these existing Security Groups (exporting the users)

    Is there any easy way to do this using powershell or some other way?

    We also use AD Manager.

    Cheers


    Tuesday, July 16, 2019 3:24 PM

All replies

  • Yes, it's easily done via PowerShell. Use the Get-ADGroupMember cmdlet to expand the membership of the group, make sure to reference each user by a unique identifier such as the UPN or objectID, then pass this to the Add-DistributionGroupMember cmdlet.

    Here's an example:

    Get-ADGroupMember OldSG | select objectGUID | % {Add-DistributionGroupMember NewDG -Member $_.ObjectGUID}

    Tuesday, July 16, 2019 6:48 PM
  • Hi,

    If you have a issue when you use above, you can try to use "name" replace ""objectGUID"

    Get-ADGroupMember OldSG | select name | % {Add-DistributionGroupMember NewDG -Member $_.name}

    Before using this command, you should create a distribution group which called "NewDG" first.

    Regards,

    Kyle Xu


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Wednesday, July 17, 2019 7:19 AM
    Moderator
  • Hi,

    I am writing here to confirm with you how thing going now?

    If the above suggestion helps, please be free to mark it as an answer for helping more people.

    Regards,

    Kyle Xu


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Monday, July 22, 2019 7:51 AM
    Moderator