Merhaba,
100'lerce GPO olan yapılar da hangi GPO Objeleri içerisinde Group Policy Preferences ayarları mevcut listelemek isterseniz aşağıdaki Powershell Script işinizi görecektir.
# Tüm GPO'ları getir
$AllGPOs = Get-GPO -All
# SYSVOL path'ini al
$Domain = (Get-ADDomain).DNSRoot
$SysvolPath = "\\$Domain\SYSVOL\$Domain\Policies"
$Result = @()
foreach ($GPO in $AllGPOs) {
$GPOGUID = $GPO.Id
$GPOName = $GPO.DisplayName
$MachinePrefPath = "$SysvolPath\{$GPOGUID}\Machine\Preferences"
$UserPrefPath = "$SysvolPath\{$GPOGUID}\User\Preferences"
$HasGPP = $false
$PrefItems = @()
# Machine tarafı kontrolü
if (Test-Path $MachinePrefPath) {
$MachineXMLs = Get-ChildItem -Path $MachinePrefPath -Recurse -Filter *.xml -ErrorAction SilentlyContinue
if ($MachineXMLs) {
$HasGPP = $true
$PrefItems += $MachineXMLs.FullName
}
}
# User tarafı kontrolü
if (Test-Path $UserPrefPath) {
$UserXMLs = Get-ChildItem -Path $UserPrefPath -Recurse -Filter *.xml -ErrorAction SilentlyContinue
if ($UserXMLs) {
$HasGPP = $true
$PrefItems += $UserXMLs.FullName
}
}
if ($HasGPP) {
$Result += [PSCustomObject]@{
GPOName = $GPOName
GPOGuid = $GPOGUID
HasGPP = $true
GPPXMLs = ($PrefItems -join '; ')
}
}
}
# Sonuçları ekrana yaz
$Result | Format-Table -AutoSize
Hiç yorum yok:
Yorum Gönder