[array]$Report = @()
$GPOs = Get-GPO -all | Sort-Object Displayname
foreach ($GPO in $GPOs) {
Write-Host "Processing GPO $($GPO.DisplayName)"
$XMLReport = Get-GPOReport -GUID $($GPO.id) -ReportType xml
$XML = [xml]$XMLReport
foreach ($gpolink in $xml.GPO.LinksTo.SomPath) {
$Report += New-Object PSObject -Property @{
'GPOName' = $xml.gpo.name
'gpoLink' = $gpolink }
}
if ($xml.GPO.LinksTo.SomPath -eq $null) {
$Report += New-Object PSObject -Property @{
'GPOName' = $xml.gpo.name
'gpoLink' = "Nolink" }
}
}
$Report | Export-CSv C:\reporting\GPOLinks.csv
No comments:
Post a Comment