Active Directory Schema

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 16 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
galliar
Posts: 1
Last visit: Thu Oct 04, 2007 6:50 am

Active Directory Schema

Post by galliar »

Hello,

I have a script copied from a primal script example. I am wondering for the select statement, where can I get a list of all valid fields? I would like to pick up description and other fields.

Regards,

Randy.

' ' Copyright (c) SAPIEN Technologies, Inc. All rights reserved' This file is part of the PrimalScript 2007 Code Samples.' ' File: ADPhoneBook.vbs ' ' Comments:' This is sample code you could use to create a phone book' based on user account information in Active Directory' ' Disclaimer: This source code is intended only as a supplement to ' SAPIEN Development Tools and/or on-line documentation. ' See these other materials for detailed information ' regarding SAPIEN code samples.' ' THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY' KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE' IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A' PARTICULAR PURPOSE.' ' **************************************************************************
On Error Resume Next
Dim objConn,objCmd,objRS Set objConn=Createobject("ADODB.Connection")Set objCmd=CreateObject("ADODB.Command")Set objRoot=Getobject("LDAP://RootDSE")Set objDomain=Getobject("LDAP://"& objRoot.get("DefaultNamingContext"))strQuery="Select cn,telephonenumber,physicaldeliveryofficename,mail from '" & _ objDomain.AdsPath & "' Where objectCategory='person' AND " & _ "objectclass='user'"set objCatalog=Getobject("GC:")for each objItem In objCatalog Set objGC=objItemNextobjConn.Provider="ADSDSOobject"objConn.Open "Active Directory Provider"objCmd.ActiveConnection=objConnobjCmd.Properties("Page Size") = 100objCmd.Properties("asynchronous")=TrueobjCmd.Properties("Timeout") =30objCmd.Properties("Cache Results") = FalseobjCmd.CommandText=strQueryset objRS=objCmd.Executedo while not objRS.EOF WScript.Echo objRS.Fields("cn") WScript.Echo objRS.Fields("telephonenumber") WScript.Echo objRS.Fields("physicaldeliveryofficename") WScript.Echo objRS.Fields("mail") objRS.movenextLoopobjRS.CloseobjConn.Close
This topic is 16 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked