[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 339
  • Last Modified:

ADO Search by AD account description

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
NorthernGuru
Asked:
NorthernGuru
  • 2
2 Solutions
 
MisterTwelveCommented:
On ADUC create a custom query and use

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

change "*" for your description
0
 
NorthernGuruAuthor Commented:
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
 
RimvisCommented:
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
 
NorthernGuruAuthor Commented:
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now