
Originally Posted by
AdamV
You might be able to pull this stuff out using dsquery and LDAP syntax, but it could get messy.
Basically, GP links are stored as attributes of the container in question (OU, site or domain). These gPLink attributes can be seen using adsiedit, and you will see they list the GUIDs of all policies linked at that container, so any query you run against an OU may give you multiple answers in return. you would then need to translate the GUIDs back to whatever you have named the policies.
This is also backwards from the way you phrased the question. As far as I know there is no way for a give GPO to find where it is linked, it is all the other way round because of the one-to-many mapping. This unfortunately means that it is not easy to identify 'orphaned' policies which are no longer linked to any containers.
You might find some useful information and be able to use the free PowerShell tools from the links in this article by MVP Darren Mar-Elia:
http://sdmsoftware.com/blog/2007/12/the_clash_of_the_gpo_links.html