List of Group Policy names applied on Organizational Units of Active Directory

Posted on 2009-03-31
Last Modified: 2012-05-06
How to get the list of names of group policies applied on organizational units of Active Directory using VB.Net ?
Question by:triharish

Accepted Solution

tegmine_it earned 250 total points
ID: 24029170
You'll need to change: ou=Students,dc=wisesoft,dc=co,dc=uk to match your OU

On Error Resume Next

Set objContainer = GetObject _


strGpLink = objContainer.Get("gPLink")

intGpOptions = objContainer.Get("gPOptions")

If strGpLink <> " " Then

    arrGpLinkItems = Split(strGpLink,"]")

    For i = UBound(arrGPLinkItems) to LBound(arrGpLinkItems) + 1 Step -1

        arrGPLink = Split(arrGpLinkItems(i-1),";")

        strDNGPLink = Mid(arrGPLink(0),9)

        WScript.Echo GetGPOName

        Select Case arrGPLink(1)

        Case 0

            WScript.Echo "No Override is cleared and the GPO is enabled."

        Case 1

            WScript.Echo "No Override is cleared and the GPO is disabled."

        Case 2

            WScript.Echo "No Override is checked and the GPO is enabled."

        Case 3

            WScript.Echo "No Override is checked and the GPO is disabled."

      End Select


    WScript.Echo VbCrLf

End If

If intGpOptions = 1 Then

    WScript.Echo "Block Policy Inheritance is checked."


    WScript.Echo "Block Policy Inheritance is not checked."

End If


Function GetGPOName

    Set objConnection = CreateObject("ADODB.Connection")  

    objConnection.Open "Provider=ADsDSOObject;"   

    Set objCommand = CreateObject("ADODB.Command")

    objCommand.ActiveConnection = objConnection

    objCommand.CommandText = _

        "<LDAP://cn=Policies,cn=System,dc=wisesoft,dc=co,dc=uk>;;" & _


    Set objRecordSet = objCommand.Execute

    Do Until objRecordSet.EOF

        If objRecordSet.Fields("distinguishedName") = strDNGPLink Then

            GetGPOName = objRecordSet.Fields("displayName")


            Exit Function

      End If




End Function

Open in new window


Author Comment

ID: 24087828
How to get the password policy present in the group policy ?

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm sure that every Windows systems administrator has written, or at least used, a batch or VBS login script at some point in their career, whether it is to map network drives, install printers, or set some user preferences.  No more! With Window…
In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now