Find linked GPO's without a GPO behind them

Alex used Ask the Experts™

I'm trying to figure out a powershell script that will pull all the GPO links that don't have a GPO assigned to them. I'm assuming it'll be something like get-gplink and then pipe that to a get-gpo and then filter out anything that isn't required, I have no idea where to even start so if anyone can either give me a script or tell me how i'd appreciate it.

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Get-GPO -All | %{[XML]$GPOs = Get-GPOReport -Name $_.DisplayName -ReportType XML; $GPOs.GPO.Name + ";" + $GPOs.GPO.LinksTo.SOMName}

Open in new window

Lists all GPOs and where they link to as CSV.

Thanks to
Sorry, its in German.
AlexSenior Infrastructure Analyst


OK but what i'm looking for are links on an OU but don't have the GPO behind it or it's been deleted, so essentially an orphaned link.
Oh sorry, got your question wrong.

Look at  the script from here:


And use the following command to get all OUs and scan them for "Orphaned" links

Get-ADOrganizationalUnit -Filter * -Properties  DistinguishedName | Select-Object -Property DistinguishedName | % {Get-Gplink -path $_.DistinguishedName} | where DisplayName -like "Orphaned*" 

Open in new window


Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial