Set GPOs Linked on a Source OU to a Target OU Using Powershell

Planted . Last tended .

This takes linked GPOs from source OU and sets them on a different OU. Useful if you create a new OU for a new server version.

$SourceOU = ''
$TargetOU = ''
$LinkedGPOs = (Get-GPInheritance -Target $SourceOU).GpoLinks
foreach ($Gpo in $LinkedGPOs) {
    New-GPLink -Guid $($Gpo.GpoId) -Target $TargetOU -Enforced No -LinkEnabled Yes
}
Updated . Thoughts? Email me.