The following sample file contents are for a domain named Cpandl.com that has organizational units (OUs) named SW Dev, Acct, and AP. The AP OU is subordinate to the Acct OU. The first line of the file defines the Active Directory object properties for user accounts to be created by the entries in the rest of the file. The remaining lines are used to create the user accounts. The first user account is created in the default Users container, and the rest of the user accounts are created in the SW Dev, Acct, and AP OUs, respectively:
objectClass,dn,sAMAccountName,userPrincipalName,userAccountControl
user,"CN=KMyer,CN=Users,DC=cpandl,DC=com",KenM,KenM@cpandl.com,514
user,"CN=WYu,OU=SW Dev,DC=cpandl,DC=com",WeiY,WeiY@cpandl.com,514
user,"CN=JMorris,OU=Acct,DC=cpandl,DC=com",JonM,JonM@cpandl.com,514
user,"CN=YXu,OU=AP,OU=Acct,DC=cpandl,DC=com",YeX,YeX@cpandl.com,514
Note |
|
Setting userAccountControl to 514 disables the user account. This is recommended because CSVDE cannot set passwords. |
The -d switch indicates the root (top) of a particular query. For example, if you want to export all the objects in the Marketing top-level OU of the Contoso.com domain to a file named marketingobjects.csv, you can use the following command:
csvde -d "ou=marketing,dc=contoso,dc=com" -f marketingobjects.csv
The -r switch is a filter for exporting information from the directory. This switch filters the output that an export request produces. For example, if you want to export only the user account object attributes from a domain to a file named usersonly.csv, you can use the following command:
csvde -r objectClass=user -f usersonly.csv
The following example exports Active Directory data to a file named search.txt, sets the search scope to subtree, and lists the sAMAccountName, CN, and distinguished name attributes for each object that is found in the search:
csvde -f search.txt -p subtree -l SamAccountName,CN,Distinguishname
The following example imports the data from the current domain (the domain that you are logged on to) from a file named input.csv:
csvde -i -f input.csv
The following example exports the data from the current domain (the domain that you are logged on to) to a file named output.csv:
csvde -f output.csv
For additional examples using CSVDE, see article 327620 in the Microsoft Knowledge Base (http://go.microsoft.com/fwlink/?LinkId=91125).