2 kinds of dsquery  results

Posted on 2011-10-18
Last Modified: 2012-05-12

i ran
dsquery * -filter "(&(objectcategory=computer)(name=*DEV*))" -attr name
and then
dsquery computer -limit 0 | find /i "DEV"

 the latter is more complete.. the first one does not show it all.. what is the reason?
in the second one, can we just have the name print like in the first one?
Question by:25112
    LVL 39

    Accepted Solution

    Please notice, that you use for search (in second case) FIND which searches for "DEV" in whole line, not only for computer's name. That;s the difference :)

    Personally, I would rely on the first syntax (it's much more accurate for me) but if you wish, you may try to check this syntax

    dsquery computer -name * -limit 0 | dsget computer -samid | find /i "DEV"

    now, you should see better output and results should be similar to the first syntax :)

    If you wish, you may read some more about DS Tools on my blog at

    There is a serie of them beginning from part 1 to part 4 (it's not finnished yet ;) )

    LVL 5

    Author Comment

    thanks Krzysztof. the write up is a great reference.. thanks for the hard work.

    the third query, is so slow:
    dsquery computer -name * -limit 0 | dsget computer -samid | find /i "DEV"

    but for obvious reasons..

    helps to confirm the point..
    LVL 39

    Expert Comment

    by:Krzysztof Pytko
    You're welcome :)


    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
    Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
    This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
    This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

    733 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now