Read a Contact object - vbscript
Active Directory Services Interface (ADSI) is a set of COM (Common Object Model) programming Interfaces. Like ODBC, ADSI provides common access to directories by adding a provider for each directory protocol type.
You can use any of the VBScript programs below in ActiveXperts Network Monitor. Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.
On this site, you can find many ADSI samples.
The read-a-contact-object ADSI class can be used in ActiveXperts Network Monitor to monitor your servers.
Example(s)
strContainer = "" strName = "EzAdContact" On Error Resume Next '*********************************************** '* Connect to an object * '*********************************************** Set objRootDSE = GetObject("LDAP://rootDSE") If strContainer = "" Then Set objItem = GetObject("LDAP://" & _ objRootDSE.Get("defaultNamingContext")) Else Set objItem = GetObject("LDAP://cn=" & strName & "," & strContainer & "," & _ objRootDSE.Get("defaultNamingContext")) End If '*********************************************** '* End connect to an object * '*********************************************** WScript.Echo VbCrLf & "** General Properties Page**" WScript.Echo "** (Single-Valued Attributes) **" strname = objItem.Get("name") WScript.Echo "name: " & strname strgivenName = objItem.Get("givenName") WScript.Echo "givenName: " & strgivenName strinitials = objItem.Get("initials") WScript.Echo "initials: " & strinitials strsn = objItem.Get("sn") WScript.Echo "sn: " & strsn strdisplayName = objItem.Get("displayName") WScript.Echo "displayName: " & strdisplayName strdescription = objItem.Get("description") WScript.Echo "description: " & strdescription strphysicalDeliveryOfficeName = objItem.Get("physicalDeliveryOfficeName") WScript.Echo "physicalDeliveryOfficeName: " & strphysicalDeliveryOfficeName strtelephoneNumber = objItem.Get("telephoneNumber") WScript.Echo "telephoneNumber: " & strtelephoneNumber strmail = objItem.Get("mail") WScript.Echo "mail: " & strmail strwWWHomePage = objItem.Get("wWWHomePage") WScript.Echo "wWWHomePage: " & strwWWHomePage WScript.Echo VbCrLf & "** General Properties Page**" WScript.Echo "** (MultiValued Attributes) **" strotherTelephone = objItem.GetEx("otherTelephone") WScript.Echo "otherTelephone:" For Each Item in strotherTelephone WScript.Echo vbTab & Item Next strurl = objItem.GetEx("url") WScript.Echo "url:" For Each Item in strurl WScript.Echo vbTab & Item Next WScript.Echo VbCrLf & "** Address Properties Page**" WScript.Echo "** (Single-Valued Attributes) **" strstreetAddress = objItem.Get("streetAddress") WScript.Echo "streetAddress: " & strstreetAddress strl = objItem.Get("l") WScript.Echo "l: " & strl strst = objItem.Get("st") WScript.Echo "st: " & strst strpostalCode = objItem.Get("postalCode") WScript.Echo "postalCode: " & strpostalCode strc = objItem.Get("c") WScript.Echo "c: " & strc WScript.Echo VbCrLf & "** Address Properties Page**" WScript.Echo "** (MultiValued Attributes) **" strpostOfficeBox = objItem.GetEx("postOfficeBox") WScript.Echo "postOfficeBox:" For Each Item in strpostOfficeBox WScript.Echo vbTab & Item Next WScript.Echo VbCrLf & "** Telephone Properties Page**" WScript.Echo "** (Single-Valued Attributes) **" strhomePhone = objItem.Get("homePhone") WScript.Echo "homePhone: " & strhomePhone strpager = objItem.Get("pager") WScript.Echo "pager: " & strpager strmobile = objItem.Get("mobile") WScript.Echo "mobile: " & strmobile strfacsimileTelephoneNumber = objItem.Get("facsimileTelephoneNumber") WScript.Echo "facsimileTelephoneNumber: " & strfacsimileTelephoneNumber stripPhone = objItem.Get("ipPhone") WScript.Echo "ipPhone: " & stripPhone strinfo = objItem.Get("info") WScript.Echo "info: " & strinfo WScript.Echo VbCrLf & "** Telephone Properties Page**" WScript.Echo "** (MultiValued Attributes) **" strotherHomePhone = objItem.GetEx("otherHomePhone") WScript.Echo "otherHomePhone:" For Each Item in strotherHomePhone WScript.Echo vbTab & Item Next strotherPager = objItem.GetEx("otherPager") WScript.Echo "otherPager:" For Each Item in strotherPager WScript.Echo vbTab & Item Next strotherMobile = objItem.GetEx("otherMobile") WScript.Echo "otherMobile:" For Each Item in strotherMobile WScript.Echo vbTab & Item Next strotherFacsimileTelephoneNumber = objItem.GetEx("otherFacsimileTelephoneNumber") WScript.Echo "otherFacsimileTelephoneNumber:" For Each Item in strotherFacsimileTelephoneNumber WScript.Echo vbTab & Item Next strotherIpPhone = objItem.GetEx("otherIpPhone") WScript.Echo "otherIpPhone:" For Each Item in strotherIpPhone WScript.Echo vbTab & Item Next WScript.Echo VbCrLf & "** Organization Properties Page**" WScript.Echo "** (Single-Valued Attributes) **" strtitle = objItem.Get("title") WScript.Echo "title: " & strtitle strdepartment = objItem.Get("department") WScript.Echo "department: " & strdepartment strcompany = objItem.Get("company") WScript.Echo "company: " & strcompany strmanager = objItem.Get("manager") WScript.Echo "manager: " & strmanager WScript.Echo VbCrLf & "** Organization Properties Page**" WScript.Echo "** (MultiValued Attributes) **" strdirectReports = objItem.GetEx("directReports") WScript.Echo "directReports:" For Each Item in strdirectReports WScript.Echo vbTab & Item Next WScript.Echo VbCrLf & "** Member Of Properties Page**" WScript.Echo "** (MultiValued Attributes) **" strmemberOf = objItem.GetEx("memberOf") WScript.Echo "memberOf:" For Each Item in strmemberOf WScript.Echo vbTab & Item Next WScript.Echo VbCrLf & "** Object Properties Page**" WScript.Echo "** (Single-Valued Attributes) **" strwhenCreated = objItem.Get("whenCreated") WScript.Echo "whenCreated: " & strwhenCreated strwhenChanged = objItem.Get("whenChanged") WScript.Echo "whenChanged: " & strwhenChanged objItem.GetInfoEx Array("canonicalName"), 0 WScript.Echo VbCrLf & "** Object Properties Page**" WScript.Echo "** (MultiValued Attributes) **" strcanonicalName = objItem.GetEx("canonicalName") WScript.Echo "canonicalName:" For Each Item in strcanonicalName WScript.Echo vbTab & Item Next