{"id":68663,"date":"2005-10-26T13:01:00","date_gmt":"2005-10-26T13:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2005\/10\/26\/how-can-i-determine-if-an-ou-is-blocking-group-policy-inheritance\/"},"modified":"2005-10-26T13:01:00","modified_gmt":"2005-10-26T13:01:00","slug":"how-can-i-determine-if-an-ou-is-blocking-group-policy-inheritance","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/how-can-i-determine-if-an-ou-is-blocking-group-policy-inheritance\/","title":{"rendered":"How Can I Determine if an OU is Blocking Group Policy Inheritance?"},"content":{"rendered":"<p><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Question\" border=\"0\" alt=\"Hey, Scripting Guy! Question\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" height=\"34\"> \n<P>Hey, Scripting Guy! How can I determine if an OU has the Group Policy property <B>Block Policy Inheritance<\/B> box checked?<BR><BR>&#8212; PP<\/P><IMG border=\"0\" alt=\"Spacer\" src=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2019\/05\/spacer.gif\" width=\"5\" height=\"5\"><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Answer\" border=\"0\" alt=\"Hey, Scripting Guy! Answer\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" height=\"34\"><A href=\"http:\/\/go.microsoft.com\/fwlink\/?linkid=68779&amp;clcid=0x409\"><IMG class=\"farGraphic\" title=\"Script Center\" border=\"0\" alt=\"Script Center\" align=\"right\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/ad.jpg\" width=\"120\" height=\"288\"><\/A> \n<P>Hey, PP. You know, sometimes you wait all your life for a situation to arise, and then it never arises. For example, one of the Scripting Guys happens to know all nine verses to the song <I>My Darlin\u2019 Clementine<\/I>. All his life he\u2019s waited for someone to say, \u201cAll nine verses to <I>My Darlin\u2019 Clementine<\/I>? I got a million dollars that says <I>no one<\/I> knows all nine verses to <I>My Darlin\u2019 Clementine<\/I>.\u201d For some strange reason, that\u2019s never happened.<\/P>\n<P>For the longest time it seemed like the same thing would happen with Group Policy inheritance. This same Scripting Guy &#8211; who seems to specialize in knowledge that few people care about &#8211; also happens to know how to tell whether or not Group Policy inheritance is enabled on an Active Directory OU. All his life he\u2019s waited for someone to say, \u201cKnow how to tell whether Group Policy inheritance is enabled on an OU? I got a million dollars that says <I>no one<\/I> knows how to tell whether or not Group Policy inheritance is blocked on an OU.\u201d And now, at last, the moment has come.<\/P>\n<P>Of course, you didn\u2019t offer a million dollars for the answer. But what the heck:<\/P><PRE class=\"codeSample\">Set objOU = GetObject(&#8220;LDAP:\/\/ou=Finance,dc=fabrikam,dc=com&#8221;)<\/p>\n<p>If objOU.gpOptions = 1 Then\n    Wscript.Echo &#8220;Block policy inheritance is enabled.&#8221;\nElse\n    Wscript.Echo &#8220;Block policy inheritance is not enabled.&#8221;\nEnd If\n<\/PRE>\n<P>Believe it or not, that\u2019s the entire script: this isn\u2019t a <I>hard<\/I> thing to do, it\u2019s just that very few people know how to do it. <\/P>\n<P>The script begins by binding to the OU in Active Directory. In our sample script, that means binding to the Finance OU in fabrikam.com:<\/P><PRE class=\"codeSample\">Set objOU = GetObject(&#8220;LDAP:\/\/ou=Finance,dc=fabrikam,dc=com&#8221;)\n<\/PRE>\n<P>After making the connection all we need to do is check the value of the <B>gpOptions<\/B> attribute. If gpOptions is equal to 1 that means that Group Policy inheritance has been blocked on the OU. If gpOptions is equal to anything else (the other two possible values are 0 and Null) then Group Policy inheritance has <I>not<\/I> been blocked. We simply set up an If Then statement to examine the value of gpOptions and then echo the appropriate message. And that\u2019s it.<\/P>\n<P>Now, who wants to make an offer on all nine verses of <I>My Darlin\u2019 Clementine<\/I>? That\u2019s OK; take your time and think it over. We\u2019ve waited this long, we can wait some more.<\/P>\n<P>Time\u2019s up: <I>now<\/I> who wants to make an offer on all nine verses of <I>My Darlin\u2019 Clementine<\/I>?<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey, Scripting Guy! How can I determine if an OU has the Group Policy property Block Policy Inheritance box checked?&#8212; PP Hey, PP. You know, sometimes you wait all your life for a situation to arise, and then it never arises. For example, one of the Scripting Guys happens to know all nine verses to [&hellip;]<\/p>\n","protected":false},"author":595,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[7,43,3,5],"class_list":["post-68663","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-active-directory","tag-ous","tag-scripting-guy","tag-vbscript"],"acf":[],"blog_post_summary":"<p>Hey, Scripting Guy! How can I determine if an OU has the Group Policy property Block Policy Inheritance box checked?&#8212; PP Hey, PP. You know, sometimes you wait all your life for a situation to arise, and then it never arises. For example, one of the Scripting Guys happens to know all nine verses to [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/68663","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/595"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=68663"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/68663\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=68663"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=68663"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=68663"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}