PowerShell Script of the Day (PSotD): Duplicate Computer Group Membership
A “regular” topic on this blog will be simple PowerShell scripts to help with your Active Directory maintenance. Often, you may need to add an additional computer to an OU. You will almost always want this new computer to have the same group membership as a computer in that existing OU.
To achieve this, you can use this script. You will need the Quest AD PowerShell Cmdlets.
==========================================================================
$SourceComputer= read-host “What is the source computer?”
$DestinationComputer= read-host “What is the destination computer?”
$Groups= Get-QADComputer $SourceComputer | Get-QADMemberof
Foreach ($Group in $Groups) {
Add-QADGroupMember $Group $DestinationComputer }
==========================================================================