ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Duplicate O365 Distribution Group via Powershell

    Scheduled Pinned Locked Moved IT Discussion
    7 Posts 3 Posters 1.4k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • gjacobseG
      gjacobse
      last edited by

      Having a bit of trouble getting a PS script to complete without errors.

      I have a Distro group which needs to be duplicated. I found a script via Technet, but it doesn't seem to work in this case.

      https://gallery.technet.microsoft.com/office/How-to-duplicate-68467217

      I need Group2 to be the same as Group1, but will have different members. As I understand, they the syntax should be:

      DuplicateEXODG.ps1 –oldDGIdentity Market –newDGIdentity newMarket
      

      However I get the following:

      Cannot bind argument to parameter 'Identity' because it is null.
          + CategoryInfo          : InvalidData: (:) [Set-DistributionGroup], ParameterBindingValidationException
          + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Set-DistributionGroup
          + PSComputerName        : outlook.office365.com
      
      -ModeratedBy : The term '-ModeratedBy' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if
      a path was included, verify that the path is correct and try again.
      At C:\~\~\DuplicateEXODG.ps1:9 char:25
      +                         -ModeratedBy $Group.ModeratedBy -ModerationEn ...
      +                         ~~~~~~~~~~~~
          + CategoryInfo          : ObjectNotFound: (-ModeratedBy:String) [], CommandNotFoundException
          + FullyQualifiedErrorId : CommandNotFoundException
      
      Cannot bind argument to parameter 'Identity' because it is null.
          + CategoryInfo          : InvalidData: (:) [Update-DistributionGroupMember], ParameterBindingValidationException
          + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Update-DistributionGroupMember
          + PSComputerName        : outlook.office365.com
      
      1 Reply Last reply Reply Quote 1
      • DustinB3403D
        DustinB3403
        last edited by

        The script you referenced is nearly 4 years old.

        1 Reply Last reply Reply Quote 0
        • DustinB3403D
          DustinB3403
          last edited by

          At the bottom of this article there are a few PS commands, get-distributiongroup and then add-DGM are likely what you need to do.

          https://o365info.com/manage-distribution-group-using-powershell-in-office-365-delete-distribution-group-and-members-convert-distribution-group-part-5-5/

          https://technet.microsoft.com/en-us/library/bb124755(v=exchg.160).aspx (Get-DG)
          https://technet.microsoft.com/en-us/library/bb124340(v=exchg.160).aspx (Add-DGM)

          1 Reply Last reply Reply Quote 0
          • NerdyDadN
            NerdyDad
            last edited by

            Is this O365 tenant tied to an on-prem AD server? If so, was the distribution group created solely within O365 or within AD?

            If it is tied to AD and the group was made within AD, then your going have to write a script that will do the same thing to AD only and not to O365.

            1 Reply Last reply Reply Quote 0
            • gjacobseG
              gjacobse
              last edited by

              Not tied to AD, never was.

              DustinB3403D 1 Reply Last reply Reply Quote 0
              • DustinB3403D
                DustinB3403 @gjacobse
                last edited by

                @gjacobse said in Duplicate O365 Distribution Group via Powershell:

                Not tied to AD, never was.

                So export a list of members in the DG, and create a new DG and then add the members. I don't know if duplicate exists on O365.

                1 Reply Last reply Reply Quote 0
                • NerdyDadN
                  NerdyDad
                  last edited by

                  Sorry I missed this earlier, but how are they duplicates if they don't have the same members? Same positions for different locations?

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post