VbsEdit, the award-winning VBScript editor that dramatically reduces the time you spend writing .VBS scripts

Sample scripts


Scripting Techniques
   Searching Active Directory
       Search for Attributes in the Global Catalog , LDAP

' Search for Attributes in the Global Catalog


On Error Resume Next

Const IS_INDEXED = 1
Const ADS_SCOPE_SUBTREE = 2

Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = _
    "SELECT lDAPDisplayName,isMemberOfPartialAttributeSet,searchFlags " _
        & "FROM 'LDAP://CN=Schema,CN=Configuration,DC=fabrikam,DC=com'"_
            & " WHERE objectClass='attributeSchema'"
Set objRecordSet = objCommand.Execute

Do Until objRecordSet.EOF
    WScript.Echo objRecordset.Fields("lDAPDisplayName"
    If objRecordset.Fields("isMemberOfPartialAttributeSet"Then
        WScript.Echo "In the global catalog."
    End If
    If IS_INDEXED AND objRecordset.Fields("searchFlags"Then
        WScript.Echo "Indexed."
    End If
    Wscript.Echo
    objRecordSet.MoveNext
Loop
objConnection.Close



VbsEdit includes all these samples!




Download Now!

Version 5.4.1 - This package includes VbsEdit 32-bit, VbsEdit 64-bit, HtaEdit 32-bit and HtaEdit 64-bit.
The evaluation version never expires.



Home   Buy Now   HtaEdit   Support   Video   What's new ?  

Copyright (C) 2001-2012 Adersoft