Tuesday, July 2, 2019

GPO PowerShell Script - Search for Group Policies with Links Disabled

#Parse XML "<LinksTo>\<Enabled>" looking for $null entries. Output  list.
#Can take a few minutes to run

$disabledlinks = New-Object System.Collections.Generic.List[System.Object]

$GPOs = Get-GPO -All

ForEach ($gpo in $GPOs)
{
    [xml]$gpoxml = Get-GPOReport -guid $gpo.Id -ReportType xml
  
    if(($gpoxml).GPO.LinksTo.Enabled -eq $false)
    {
        $disabledlinks.add($gpoxml.gpo.name)
    }
}

$unlinkedGPOs | out-gridview

No comments:

Post a Comment