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

    AD copy account memebership

    Scheduled Pinned Locked Moved IT Discussion
    8 Posts 2 Posters 844 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.
    • J
      Jason Banned
      last edited by

      looking at this script is there a way to make it so it works on two domians? ex from is domain A to is domain B.

      There is a trust in place, and can be done manually but it's a lot of work to do manually.

      https://community.spiceworks.com/scripts/show/2425-ad-gui-copy-selected-groups-from-one-user-to-another

      1 Reply Last reply Reply Quote 1
      • J
        Jason Banned
        last edited by

        If not does anyone know something to accomplish this?

        1 Reply Last reply Reply Quote 0
        • dafyreD
          dafyre
          last edited by

          It could probably be done... What are you trying to do? Copy user groups from Domain A to Domain B?

          J 1 Reply Last reply Reply Quote 0
          • J
            Jason Banned @dafyre
            last edited by

            @dafyre said:

            It could probably be done... What are you trying to do? Copy user groups from Domain A to Domain B?

            No, just copy the member ship from User account in Domain A to User accounts in Domain B. Groups will stay on domain A, and users in domain b will become members.

            1 Reply Last reply Reply Quote 0
            • dafyreD
              dafyre
              last edited by

              So wait... you want to copy the group membership from DOMAINA\jane.doe to DOMAINB\john.smith ?

              J 1 Reply Last reply Reply Quote 1
              • J
                Jason Banned
                last edited by

                This one should be easier to modify if I can figure out how and would be better anyway. I just need to figure out how to make the second account from another domain.

                import-module ActiveDirectory
                cls 
                write-output "This script adds the destination user to all the Groups which the source user is memberof." 
                write-output " " 
                write-output " " 
                $SName = Read-Host "Please Enter the alias name of the source user " 
                $DName = Read-Host "Please Enter the alias name of the Destination user " 
                  
                $K = Get-ADUser -Identity $SName -Properties memberOf
                foreach($group in $K.memberof)  
                {  
                Add-ADGroupMember -Identity $group -Member $DName 
                write-output $group 
                }  
                
                1 Reply Last reply Reply Quote 0
                • J
                  Jason Banned @dafyre
                  last edited by

                  @dafyre said:

                  So wait... you want to copy the group membership from DOMAINA\jane.doe to DOMAINB\john.smith ?

                  Basically.

                  1 Reply Last reply Reply Quote 0
                  • J
                    Jason Banned
                    last edited by

                    This worked

                    import-module ActiveDirectory
                    cls 
                    write-output "This script adds the destination user to all the Groups which the source user is memberof." 
                    write-output " " 
                    write-output " " 
                    $SName = Read-Host "Please Enter the alias name of the source user " 
                    $DName = Read-Host "Please Enter the alias name of the Destination user " 
                    $DN = Get-ADUser $DName -Server DOMAINBDC
                    $K = Get-ADUser -Identity $SName -Properties memberOf
                    foreach($group in $K.memberof)
                     
                    {  
                    Add-ADGroupMember -Identity $group -Member $DN 
                    write-output $group 
                    }  
                    
                    1 Reply Last reply Reply Quote 1
                    • 1 / 1
                    • First post
                      Last post