Created
July 31, 2015 05:51
-
-
Save poshcodebear/3df3b46ec3d03c2075b6 to your computer and use it in GitHub Desktop.
Copy Group Policy links from one OU to another
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$SourceOU = "Source OU" | |
$DestinationOU = "OU=Destination OU,DC=badwolf,DC=local" | |
[xml]$gpos = Get-GPOReport -all -ReportType xml | |
foreach ($gpo in $gpos.gpos.gpo) { | |
if ($gpo.LinksTo.SOMName -eq $SourceOU) { | |
New-GPLink -Name $gpo.name -Target $DestinationOU | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment