document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. GPOGuid
  2. $SourceGPO = "ABC8823c-379e-4b4d-a5ff-8c94cdad9424"
  3. $rootPaths= "HKCU\\Software"
  4.  
  5.     $ArrayData=@()
  6.     $Getdetails = Get-GPRegistryValue -guid $SourceGPO -Key $rootPaths -Verbose -ErrorAction Stop
  7.  
  8.     function Get-MyGPORegistry ($Getdetails){
  9.    
  10.         foreach ($Member in $Getdetails) {
  11.         try {
  12.          # write-host  DIVE - $Member.FullKeyPath            
  13.          
  14.             if ([string]::IsNullOrEmpty($Member.PolicyState) ) {
  15.            $Getdetails= Get-GPRegistryValue -guid $SourceGPO -Key $member.FullKeyPath -Verbose -ErrorAction Stop
  16.            Get-MyGPORegistry -Getdetails $Getdetails
  17.            } else{
  18.             $Member.FullKeyPath
  19.             $global:ArrayData+=$member # HAS TO BE A BETTER WAY
  20.             }
  21.         } catch {}
  22.  
  23.        }
  24.     }
  25.  
  26.     Get-MyGPORegistry -getdetails $Getdetails
  27.  
  28. $ArrayData | Export-Csv -Path C:\\users\\panda\\Desktop\\gporegistry.csv -NoTypeInformation
  29.  
  30. $internetSettings=$ArrayData|?{ $_.Fullkeypath -match "Internet Settings"}
  31.  
  32.  
  33. $DestinationGPO = "ABC9F8C3-C06F-4996-937D-97FA75F66307"
  34.  
  35. foreach ($value in $internetSettings){
  36.  
  37.  # Assumes PolicyState = "Set" would require rewrite for "Delete"
  38.  Write-Verbose "SETTING SET [$($Value.FullKeyPath):$($Value.Valuename)]"
  39.  $Value | Set-GPRegistryValue -guid $DestinationGPO -Verbose
  40.  }
');