23 C
Dubai
Wednesday, December 18, 2024

Copy Active Directory Group members to new group

Migrating Members from Old group to New group in Active directory

image

image

Group Attribute Editor – Collect DistinguishedName Value for Old and New Group

image

Open PowerShell in Directory Server

Import-Module Activedirectory

$oldgroup = Get-ADGroup "CN=OLD_Group,OU=02 Groups,DC=Cloudid,DC=biz"
$newgroup = Get-ADGroup "CN=New_Group,OU=02 Groups,DC=Cloudid,DC=biz"

To Test – (-Whatif)

Get-ADGroupMember $oldgroup | foreach{Add-ADGroupMember $newgroup -Members $_.distinguishedName -WhatIf}

Remove –Whatif to Execute it.

image

To Execute –

Get-ADGroupMember $oldgroup | foreach{Add-ADGroupMember $newgroup -Members $_.distinguishedName}

image

You can see members migrated to new group

image

Satheshwaran Manoharan
Satheshwaran Manoharanhttps://www.azure365pro.com
Award-winning Technology Leader with a wealth of experience running large teams and diversified industry exposure in cloud computing. From shipping lines to rolling stocks.In-depth expertise in driving cloud adoption strategies and modernizing systems to cloud native. Specialized in Microsoft Cloud, DevOps, and Microsoft 365 Stack and conducted numerous successful projects worldwide. Also, Acting as a Technical Advisor for various start-ups.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

× How can I help you?