Results 1 to 4 of 4

Thread: DSQuery list user for entire forest

  1. #1
    Join Date
    Feb 2011
    Location
    Wash DC
    Posts
    1

    DSQuery list user for entire forest

    Hi,

    I am trying to get a list of user atributes for the entire AD forest. The command string that I have so far, returns all of the atributes that I want, but It only returns from the child domain that I am currently logged into.

    How do get it to return result from the entire forest?

    Here is the command that I am using.

    dsquery.exe * -limit 0 -filter "(&(objectCategory=person)(objectClass=user)(mail=*))" -attr userPrincipalName title givenName initials sn mail streetAddress st postalCode co telephoneNumber ADsPath >"c:\PrimaryEmailAddresses3.txt"


    What do I need to change to make it return all results from the entire forest and all child domains?

    I am new to this tool. Any help is greatly appreciated.

    Thanks

  2. #2
    Join Date
    Feb 2011
    Posts
    3

    Re: DSQuery list user for entire forest

    How many domains do you have in your forest?
    Is there a list of attributes you are looking to get?

    If you start your command with DSQUERY USER...you can start the location in the forestroot. Then you can pipe the line to DSGET USER to pull more attributes like -email - upn - office -tel.
    i.e. --> DSQUERY USER forestroot -limit 0 | DSGET USER -upn -fn -ln -tel -display -office -hmdir > C:\PrimaryEmailAddresses3.txt

  3. #3
    Join Date
    Jul 2013
    Posts
    106

    Re: DSQuery list user for entire forest

    I am also new to this and trying to learn how to use DSQuery. I also want some help here to import user details all at once. I had copied a syntax directly from the web and tried that. But it brought up weird results and not able to give me the kind of output which I am looking for. This command looks a bit complicate to use. I had tested it out with few changes but still not getting full information. Can anyone help me to understand and use the same in easier way.

  4. #4
    Join Date
    May 2011
    Posts
    234

    Re: DSQuery list user for entire forest

    I am giving you a link below which has a bit detail information in using the same. This page has a proper output of running this syntax and getting appropriate output from the same. It is a command line tool and to get proper result you must run this always in administrator account. If won't do the same you might not get the result. The link has all parameter details. This will help you to get the right syntax.

    http://technet.microsoft.com/en-us/l.../cc725702.aspxDsquery user

Similar Threads

  1. LDIFDE for backup of entire forest/domain
    By NGV BalaKrishna in forum Active Directory
    Replies: 5
    Last Post: 15-09-2010, 03:52 PM
  2. DSQUERY: list users created after a specific date
    By AndieB in forum Active Directory
    Replies: 2
    Last Post: 27-11-2008, 01:05 AM
  3. dsquery to list members of group
    By joey in forum Windows Server Help
    Replies: 1
    Last Post: 05-11-2008, 08:43 AM
  4. List of Last Logon Time with dsget/dsquery
    By Viensterrr in forum Active Directory
    Replies: 1
    Last Post: 17-09-2008, 05:36 PM
  5. DSQUERY to find user not logged in for 120 days
    By Vera Noest in forum Active Directory
    Replies: 2
    Last Post: 26-01-2005, 06:57 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,585,906.21216 seconds with 17 queries