Use the CSVDE command to import/export AD users in batches, csvdead

Source: Internet
Author: User

Use the CSVDE command to import/export AD users in batches, csvdead
You can use the CSVDE command to import/export CSV files with user information to/from AD in batches. The basic syntax command for import is as follows:

csvde -i -f c:\filename.csv -k
Run the following command to view the specific parameters:
csvde /?

First, set user information in Excel and save the file as csv format.
Run the import command in cmd.
As you can see, the import is successful. View in AD:
We can see two new users, but they are different from the other three, with a downward arrow. This is because the CSVDE command cannot import passwords, so the imported users are disabled. Next, we will batch Set passwords, enable accounts, and set passwords to never expire. Run the following command: (see examples (WS.10). aspx)
Dsquery user "ou = T0500 _ customer, ou = T0000 _ test Internet users, ou = XXX, dc = XXX, dc = com "| dsmod user-pwd 123 @ abc-pwdneverexpires yes-disabled no
Run the following command to export AD information:
csvde -f E:\20131015.csv -r "(objectClass=user)" -d "OU=XXX,DC=XXX,DC=com" -u
OU is processed here. You should replace it with your own attribute value when using it. This command exports the AD user to the E disk. I use the current date as the file name and save it as a csv file (the csv file can be opened in Excel ).


2003 batch export, Domain Users in use

Procedure:
I. Use CSVDE to export accounts
Using CSVDE to export the list of existing objects is quite simple.
The simplest usage is:
Csvde-f ad.csv directs the Active Directory object to the file named ad.csv. -F indicates the name of the output file.
However, you must note that the above usage is simple, but the exported results may have too many records and information you do not want.
To export records more accurately, you can use the-d,-r, and-l parameters.
Where:-d is used to specify a specific search location and range.
-R is used to specify a specific search object type.
-L is used to specify the specific attributes of the exported object.
For example:
Csvde-f users.csv-d "ou = Users, dc = contoso, dc = com"-r "(& (objectcategory = person) (objectclass = user)"-l DN, objectClass, description
Note: If the account information exported using CSVDE contains Chinese characters, garbled characters may exist. You can add the-U parameter to solve this problem.
Ii. Import accounts in batches
To import accounts in batches, a file containing multiple accounts must exist. Batch import is not allowed because there are no files.
Assume that you have used the csvdetool to export the users.csv file. The file content is as follows:

Name, full name, login name, password
Zhang, San, zhang San, three. zhang, pass01
Li, Si, li Si, four. li, passo2
Wang, Wu, wang Wu, five. wang, pass03
Liu, six. liu, passo4.
Zhao, Qi, zhao Qi, seven. zhao, pass05

With the above format, we can use the For command to read each piece of information in the file and use DSADD to add an account.
The statement is as follows:
C: \> for/f "tokens = 1, 2, 3, 4, 5 delims =," % a in (uses.csv) do dsadd user "cn = % c, ou =
Newusers, dc = contoso, dc = com "-samid % d-upn % d@contoso.com-fn
% B-ln % a-pwd % e-disabled no
Purpose: add the five accounts in the preceding file to the contoso.com domain named newusers OU, and the user is enabled by default.
Where-samid is the login name
-Upn is the logon name of UPN.
-Fn: Name
-Ln is the surname
-Pwd is the password

A brief explanation of the for statement
/F indicates reading information from the file
Tokens indicates the mark used by each row, which corresponds to the specific value of the Variable
Delims indicates the delimiter between each field... the remaining full text>
 
In windows 2003 server sp2, what are the batch commands used to export batch user names and import data to new servers?

I. Use CSVDE to export accounts
Using CSVDE to export the list of existing objects is quite simple.
The simplest usage is:
Csvde-f ad.csv directs the Active Directory object to the file named ad.csv. -F indicates the name of the output file.
However, you must note that the above usage is simple, but the exported results may have too many records and information you do not want.
To export records more accurately, you can use the-d,-r, and-l parameters.
Where:-d is used to specify a specific search location and range.
-R is used to specify a specific search object type.
-L is used to specify the specific attributes of the exported object.
For example:
Csvde-f users.csv-d "ou = Users, dc = contoso, dc = com"-r "(& (objectcategory = person) (objectclass = user)"-l DN, objectClass, description
Note: If the account information exported using CSVDE contains Chinese characters, garbled characters may exist. You can add the-U parameter to solve this problem.
Ii. Import accounts in batches
To import accounts in batches, a file containing multiple accounts must exist. Batch import is not allowed because there are no files.
Assume that you have used the csvdetool to export the users.csv file. The file content is as follows:

Name, full name, login name, password
Zhang, San, zhang San, three. zhang, pass01
Li, Si, li Si, four. li, passo2
Wang, Wu, wang Wu, five. wang, pass03
Liu, six. liu, passo4.
Zhao, Qi, zhao Qi, seven. zhao, pass05

With the above format, we can use the For command to read each piece of information in the file and use DSADD to add an account.
The statement is as follows:
C: \> for/f "tokens = 1, 2, 3, 4, 5 delims =," % a in (uses.csv) do dsadd user "cn = % c, ou =
Newusers, dc = contoso, dc = com "-samid % d-upn % d@contoso.com-fn
% B-ln % a-pwd % e-disabled no
Purpose: add the five accounts in the preceding file to the contoso.com domain named newusers OU, and the user is enabled by default.
Where-samid is the login name
-Upn is the logon name of UPN.
-Fn: Name
-Ln is the surname
-Pwd is the password

A brief explanation of the for statement
/F indicates reading information from the file
Tokens indicates the mark used by each row, which corresponds to the specific value of the Variable
Delims indicates the delimiter between each field... the remaining full text>
 

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.