Link to home
Start Free TrialLog in
Avatar of HalCHub
HalCHubFlag for United States of America

asked on

ldap searching using vbs

Given

Dim strDescription
 
Const ADS_SCOPE_SUBTREE = 1000
 
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand =   CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
 
Set objCOmmand.ActiveConnection = objConnection
objCommand.CommandText = _
    "Select Name, Location, Description from 'LDAP://s.d.local/DC=s,DC=d,DC=local' Where objectClass='computer'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE  
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
 
Wscript.Echo "Computer Name"
 
do Until objRecordSet.EOF
 
WScript.Echo objRecordSet.Fields("Name").Value
objRecordSet.MoveNext
loop

What is the correct object class to return all computes in a domain ?

I am getting Active Directory: There is no such object on the server
ASKER CERTIFIED SOLUTION
Avatar of Joshua Grantom
Joshua Grantom
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of HalCHub

ASKER

How did you get so smart :).. Thank you and have a great weekend.
Lol, thanks. You as well.