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