1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

how to work out number of users/comps in AD

Discussion in 'Active Directory Exams' started by thetokyoproject, Jul 27, 2008.

  1. thetokyoproject

    thetokyoproject Byte Poster

    141
    1
    17
    just wanted to know how to work out how many active users and computers there are in a domain via AD?

    Cheers.
     
    Certifications: 271
  2. Mr.Cheeks

    Mr.Cheeks 1st ever Gold Member! Gold Member

    5,369
    85
    190
    this works in a workgroup, unsure bout domain and AD querying
    start > run >
    net users /domain >filename.txt

    best thing is to search the net for a vb script
     
  3. Theprof

    Theprof Petabyte Poster Forum Leader

    4,570
    68
    196
    Have you tried using the DSQuery command? this website gives some examples as to how to use the command. Also there are plenty of resources on the technet site about this type of stuff.
     
    Certifications: A+ | CCA | CCAA | Network+ | MCDST | MCSA | MCP (270, 271, 272, 290, 291) | MCTS (70-662, 70-663) | MCITP:EMA | VCA-DCV/Cloud/WM | VTSP | VCP5-DT | VCP5-DCV
    WIP: VCAP5-DCA/DCD | EMCCA
  4. NightWalker

    NightWalker Gigabyte Poster

    1,172
    25
    92
    Yep, dsquery is the best way.
     
    Certifications: A+, Network+, MCP, MCSA:M 2003, ITIL v3 Foundation
  5. Obinna Osobalu

    Obinna Osobalu Banned

    539
    7
    0

    The DSQUERY command queries Active Directory for objects that match a specific criteria
    set. The command’s basic syntax is:

    dsquery object_type [{StartNode | forestroot | domainroot}] [-o {dn | rdn | samid}] [-scope {subtree | onelevel | base}] [-name Name] [-desc Description] [-upn UPN] [-samid SAMName] [-inactive NumberOfWeeks] [-stalepwd NumberOfDays] [-disabled] [{-s Server | -d Domain}] [-u UserName] [-p {Password | *}]

    Keep in mind, this command will often be used to generate a list of objects against which you will run other command-line utilities. This is accomplished by piping the output to the second command. For example, the following command line queries Active Directory for a user object with a name starting with “Dan,” pipes the result set to DSMOD, which disables each object in the result set: dsquery user -name Dan* | dsmod user -disabled yes The other utilities accept DNs as their input, which is the default output type as well.

    But then a VBscript(you can get that on the net, just google it!) will be much easier because you wont have to deal with the syntax.
     
    Certifications: MCITP:SA,MCTS(x5),MCSE2K3;MCSA2K3:M;MCP
    WIP: EDA7,70-652,Project+,MSP(70-632)

Share This Page

Loading...