This PowerShell script copies all members from a source Active Directory group to a target Active Directory group. Before running the script, update the source and target group names to match your Active Directory environment.
Import-Module ActiveDirectory
$gsource =Get-ADGroup "Test Group1"
$gtarget = Get-ADGroup "Test Group2"
Get-ADGroupMember -Identity $gsource |
foreach {Add-ADGroupMember -Identity $gtarget -Members $($_.DistinguishedName)}
Related Posts
- Powershell – Get System up time
- Powershell Script : List AD Organizational Unit and GPOs linked to them
- Powershell – Compare hardware and software details on two computers
- Powershell Script : Retrieve AD Computers Properties
- Powershell – Merge CSV files & Insert file name as a column
- Powershell Script: Validate if Computer account exists in Active Directory
- Powershell remote – WinRM cannot complete the operation
- Powershell script to Add bulk users / computers to AD Group
- PowerShell Script : Copy AD Group Membership
- Using PowerShell Behind a Proxy Server