GetEx (VBScript)

This code can be found in Chapter 21 of Active Directory, 3rd Edition

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the VBScript code from this site.

' From the book "Active Directory, Third Edition" 
' ISBN: 0-596-10173-2

Dim objUser        'An ADSI user object
Dim arrPhoneList   'An array of phone numbers
Dim strPhoneNumber 'An individual phone number
Set objUser=GetObject("LDAP://cn=administrator,cn=Users,dc=mycorp,dc=com")
arrPhoneList = objUser.GetEx("telephoneNumber")
For Each strPhoneNumber In arrPhoneList
  WScript.Echo strPhoneNumber
Next

This code has been viewed 2729 times.

New from the creators of TechTasks.com: StatSheet.com