Solved

ldap searching using vbs

Posted on 2014-09-19
3
155 Views
Last Modified: 2014-09-19
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
0
Comment
Question by:HalCHub
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
Joshua Grantom earned 500 total points
ID: 40333400
This

 "Select Name, Location, Description from 'LDAP://s.d.local/DC=s,DC=d,DC=local' Where objectClass='computer'"

Should be this

    "Select Name, Location from 'LDAP://DC=fabrikam,DC=com' " _
        & "Where objectClass='computer'"
0
 
LVL 1

Author Closing Comment

by:HalCHub
ID: 40333600
How did you get so smart :).. Thank you and have a great weekend.
0
 
LVL 16

Expert Comment

by:Joshua Grantom
ID: 40333601
Lol, thanks. You as well.
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now