' Verify Whether Attributes are Indexed and-or in the Global Catalog

Const IS_INDEXED = 1

Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"

Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection

objCommand.Properties("Sort On") = "isMemberOfPartialAttributeSet"

objCommand.CommandText = _
    "<LDAP://CN=Schema,CN=Configuration,DC=fabrikam,DC=com>;" & _
        "(objectClass=attributeSchema);" & _
            "lDAPDisplayName, isMemberOfPartialAttributeSet,searchFlags;onelevel"

Set objRecordSet = objCommand.Execute

Do Until objRecordSet.EOF
    WScript.Echo objRecordset.Fields("lDAPDisplayName")
    If objRecordset.Fields("isMemberOfPartialAttributeSet")Then
        WScript.Echo "In the global catalog."
        WScript.Echo "Not in the global catlog."
    End If

    If IS_INDEXED AND objRecordset.Fields("searchFlags") Then
        WScript.Echo "Is indexed."
        WScript.Echo "Is not indexed."
    End If
    Wscript.Echo VbCrLf

search for scripts

VbsEdit contains all these sample scripts!

Download Now!

Download   Home   Scripts

Copyright © 2001-2022 adersοft