Link to home
Start Free TrialLog in
Avatar of 25112
25112

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Krzysztof Pytko
Krzysztof Pytko
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 25112
25112

ASKER

neat.. how about sorting them by alphabet?
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
Avatar of 25112

ASKER

OK- thanks for explaining..

Get-QADComputer does not work for me, is it not part of win os like dsquery?
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
Avatar of 25112

ASKER

thank you Krzysztof for sharing your knowledge
No problem, you're welcome :)

Krzysztof