Solved

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

Posted on 2009-03-31
3
884 Views
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 ?
0
Comment
Question by:triharish
3 Comments
 
LVL 5

Accepted Solution

by:
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 _

    ("LDAP://ou=Students,dc=wisesoft,dc=co,dc=uk")
 

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

    Next

    WScript.Echo VbCrLf

End If
 

If intGpOptions = 1 Then

    WScript.Echo "Block Policy Inheritance is checked."

Else

    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>;;" & _

            "distinguishedName,displayName;onelevel"

    Set objRecordSet = objCommand.Execute
 

    Do Until objRecordSet.EOF

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

            GetGPOName = objRecordSet.Fields("displayName")

            objConnection.Close

            Exit Function

      End If

      objRecordSet.MoveNext

    Loop

    objConnection.Close

End Function

Open in new window

0
 

Author Comment

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

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ADFS 3.0 and UPN Problem 6 16
GPO Delegation 4 16
Active Directory screwed 9 37
Question on security Audit 2 59
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…
[b]Ok so now I will show you how to add a user name to the description at login. [/b] First connect to your DC (Domain Controller / Active Directory Server) SET PERMISSIONS FOR SCRIPT TO UPDATE COMPUTER DESCRIPTION TO USERNAME 1. Open Active …
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…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

747 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

17 Experts available now in Live!

Get 1:1 Help Now