Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what does this script do ?

Status
Not open for further replies.

123457

Programmer
Mar 9, 2002
4
AZ
Set objXL = CreateObject("Excel.Application")
objXL.Visible = True
intRow = 1
intColumn = 1
objXL.Workbooks.Add

Set objOU = GetObject("LDAP://ou=Canada,dc=pcd,dc=NesbittBurns,dc=ca")
objXL.Cells(intRow, intColumn).Value = "Canada"

LdapSearch objOU

Function LdapSearch ( objLDAPloc )
Dim objADObject
For Each objADObject in objLDAPloc
Select case objADObject.Class
case "organizationalUnit"
LDAPsearch (objADObject) 'Recurse
case "computer"
set OUPnt = GetObject(objADObject.Parent)
intColumn = 1

objXL.Cells(intRow, intColumn).Value = _
Right(OUPnt.Name, Len(OUPnt.Name) - 3)

intColumn = intColumn + 1
objXL.Cells(intRow, intColumn).Value = objADObject.CN
intRow = intRow + 1
End Select
Next
End Function
 
it looks like it opens a connection to a laptop (ldap cable) and searches for ado clases. when it finds one called organizational unit it looks for one called computer, and puts the name of that object in an excel speadsheet.

just a guess but it looks like a way to id the name of a remote computer.

caution: i dont know for sure im pretty new to vbscript.
 
Head over to the MSDN and read-up on ADSI.

It appears to list the names of all the computers who are members of the Canada domain. Jon Hawkins
 
An LDAP is a type of Protocol for accessing directories.

(Lightweight Directory Access Protocol)

So it looks like they are accessing data and importing it into Excel.

- Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top