CSVDE and Import-csv


CSVDE AD users export from OU:
C:\>csvde -f c:\serNamesExport.csv -d “OU=Students,DC=sdc2,DC=local” -r obje
ctClass=user -l “dn,cn,displayName,description,title,department,company,displayN
ame,givenName,sn,title,manager,memberof,userPrincipalName,SamAccountname”

Import: (using csvde -i to import caused account to be disable, so preferred using import-csv powershell command.

csvde -i -f serNamesExport.csv

Alternative approach to export AD users objects:

Save as *.csv (you can use excel to manupulate or change contents accordingly)

Format the .csv file (samples):
userPrincipalName,SamAccountName,Name,GivenName,SurName,Title,Department
alex.wong@dc1.local,alex.wong,Alex Wong,Alex,Wong,CTO,ICT
adam.tan@dc1.local,adam.tan,Adam Tan,Adam,TAN,IT,Information Technology

AD power-shell:
Import-Module ActiveDirectory

Import-Csv “c:\users.csv” | foreach-object {New-ADUser -SamAccountName $_.”SamAccountName” -Name $_.”name” -GivenName $_.”GivenName” -SurName $_.”SurName” -Title $_.”Title” -Department $_.”Department” -UserPrincipalName $_.”UserPrincipalName” -AccountPassword (ConvertTo-SecureString “p@ssword88” -AsPlainText -force) -Enabled $True -PasswordNeverExpires $True -PassThru -Path “OU=students,dc=SDC1,dc=local”}

Advertisements

About Robiul

Robiul has 15 years of continuous successful career experience in ICT with extensive background in System Engineering, IT infrastructure design, operations and service delivery, managing IT projects / MIS functions for local and multi-national companies with in-depth knowledge of multiple operating systems as well as construct / manage small to medium size Data Center. Proven ability to design and implement medium to semi-large scale LAN/WAN/WLAN and system infrastructures. Academic qualification: Master of Science in Information Systems. Professional certifications are: MCSE, CCNA, ITIL and FoundStone Security Professional, VCP, NetAPP, CISSP etc.
This entry was posted in Windows and tagged . Bookmark the permalink.