Copy all GPOs from one forest to another

September 20, 2016

Hey, The following presents a PS Script that Copy all GPOs from one forest to another, Backed up all GPOs in one domain using Backup-GPO Imported them to the other forest by using Import-GPO Load the following Modules before run PS Script: Import-Module ActiveDirectory            Import-Module GroupPolicy    $sPath = "X:\GPOFOLDER" $list = get-childitem $sPath | Select name foreach ($item in $list) {     $fXML = $sPath + "\" + $item.Name + "\gpreport.xml"     $XMLData = (get-content $fXML)     $GPOName = $XMLData.GPO.Name     import-gpo -BackupId $item.Name -TargetName $GPOName -path $sPath -CreateIfNeeded }        
tags:
no comments