?
Solved

ADO Search by AD account description

Posted on 2011-09-13
4
Medium Priority
?
332 Views
Last Modified: 2012-06-22
Hi,

I'm trying to search for a number of AD computer accounts based on their description, but can't seem to get the query right.

"SELECT ADsPath, Description, Name FROM 'LDAP://" & strRootOUDN & strDomainDN & "' WHERE " & "objectClass='computer' AND description <> '" & strSubnet & "'"

Whatever I do to play around with the "AND description" part of the query returns either everything or nothing.  

The description field of our computer accounts contain the machines IP address, so I'm looking to return a set of records containing all computers whose description field begins with "192.168.1." (for example).

Does anybody know the correct query syntax for this?

Cheers

Andy
0
Comment
Question by:NorthernGuru
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 5

Assisted Solution

by:MisterTwelve
MisterTwelve earned 400 total points
ID: 36530854
On ADUC create a custom query and use

(&(objectCategory=computer)(objectClass=computer)(description=*))

change "*" for your description
0
 

Author Comment

by:NorthernGuru
ID: 36534240
Ah, sorry. I probably should have mentioned that I'm trying to do this via a query inside a vbscript.

How would this translate?

Cheers

Andy
0
 
LVL 19

Accepted Solution

by:
Rimvis earned 1600 total points
ID: 36534507
Hi NorthernGuru,

Try this:
"SELECT ADsPath, Description, Name FROM 'LDAP://" & strRootOUDN & strDomainDN & "' WHERE objectClass='computer' AND description = '192.168.1.*'

Open in new window

0
 

Author Comment

by:NorthernGuru
ID: 36558974
Thanks Rimvis

This worked perfectly.  I have no idea why I didn't just try this in the first place.  I feel pretty stupid now !

Much appreciated.  Cheers !
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
Uncontrolled local administrators groups within any organization pose a huge security risk. Because these groups are locally managed it becomes difficult to audit and maintain them.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses
Course of the Month13 days, 15 hours left to enroll

801 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