Solved

ADO Search by AD account description

Posted on 2011-09-13
4
330 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 100 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 400 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

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Group policies can be applied selectively to specific devices with the help of groups. Utilising this, it is possible to phase-in group policies, over a period of time, by randomly adding non-members user or computers at a set interval, to a group f…
This video shows how to use Hyena, from SystemTools Software, to update 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…

705 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