Find unlinked GPOs in your domain

Have you ever wondered if your domain has any GPO without a link and which GPO that would be? This is how you find out with Powershell with output to the screen.

$unlinkedGPOs = (Get-GPO -all | where {([xml]($_ | Get-GPOReport -ReportType XML)).gpo.LinksTo.Length -eq 0})
Write-Host "The following GPO has no link:"
$unlinkedGPOs| ft DisplayName -HideTableHeaders
Write-Host "Total: $($unlinkedGPOs.Count)"