Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

combine dsquery and order the results

in sql we may do something like
SELECT NAME FROM TABLE
WHERE NAME LIKE '%POS%DEV%' OR NAME LIKE '%DEV%DEP%' OR NAME  LIKE '%PSR%DEV%' ORDER BY NAME DESC

can we combine the following three into one statement

dsquery * -filter "(&(objectcategory=computer)(name=*POS*DEV*))" -attr name
dsquery * -filter "(&(objectcategory=computer)(name=*DEV*DEP*))" -attr name
dsquery * -filter "(&(objectcategory=computer)(name=*PSR*DEV*))" -attr name
0
25112
Asked:
25112
  • 4
  • 3
1 Solution
 
Krzysztof PytkoActive Directory EngineerCommented:
Hi,

have you tried this syntax? :)

dsquery * -filter "(&(objectcategory=computer)(|(name=*POS*DEV*)(name=*DEV*DEP*)(name=*PSR*DEV*)))" -attr name

Regards,
Krzysztof
0
 
25112Author Commented:
neat.. how about sorting them by alphabet?
0
 
Krzysztof PytkoActive Directory EngineerCommented:
Unfortunately DS Tools doesn't allow for that :) They are old-fashioned tools. I would suggest to use for that Quest PowerShell module for AD. It's completely free and can be downloaded from
http://www.quest.com/powershell/activeroles-server.aspx

and use LDAP syntax

Get-QADComputer -LdapFilter "(&(objectCategory=computer)(|(name=*POS*DEV*)(name=*DEV*DEP*)(name=*PSR*DEV*)))" | select name | Sort-Object name

Krzysztof
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
25112Author Commented:
OK- thanks for explaining..

Get-QADComputer does not work for me, is it not part of win os like dsquery?
0
 
Krzysztof PytkoActive Directory EngineerCommented:
Nope, as I wrote you need for that Quest PowerShell module for AD (separate PowerShell download). It's completely free but you need local administrative privileges to install it on your workstation

Krzysztof
0
 
25112Author Commented:
thank you Krzysztof for sharing your knowledge
0
 
Krzysztof PytkoActive Directory EngineerCommented:
No problem, you're welcome :)

Krzysztof
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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