How to export a user under a specified OU through the dsquery command

Source: Internet
Author: User
Tags dsquery

Today, colleagues in the maintenance of the ad when said that want to export a user under an OU to do the collation, so think of the dsquery command to do the inspection and export, specific see below:

General company AD Architecture is not the same, if you want to query users and computers as long as the flexibility to apply dsquery everything OK

Here is the AD schema in my test environment, I created an organizational unit named object DSGRD within the architecture, and then I created two child organizational units under this organizational unit, and now I need to query the sub-organizational unit. Users and exports within the multinational enterprise group;

Note: If there are multilevel OUs, the level two OUs are in front of the first level of the OU, as well as the script files and command input.

dsquery user "ou= multinational enterprise (Level two OU) group, Ou=object dsgrd (First level OU), DC=DSGRD (Domain name), dc=com"

Add-limit xxx (100000) parameter if the number of users in the OU is more than

dsquery user "ou= multinational enterprise (Level two OU) group, Ou=object dsgrd (First level OU), DC=DSGRD (Domain name), dc=com"-limit 100000

If you need to export after the query, we are exporting via redirect >

dsquery user "ou= multinational enterprise (Level two OU) group, Ou=object dsgrd (First level OU), DC=DSGRD (Domain name), dc=com"-limit 100000 ">c:\123.txt

The meaning is to query and export the user within the multinational enterprise (Level two OU) group to the 123.txt file under C disk, the 123.txt file is generated automatically.

If I have 1000 users in a multinational business group, I need to add-limit 10001 or more than this parameter under the dsquery command, in short, limit xx is larger than the number of people in the OU before querying the user.

I have 3 users in the OU within my multinational business group.

We first query and display the user

And then export it after the query

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.