by Dios_007 at 2012-10-24 04:19:52
Hi Allby Klaas at 2012-10-24 04:32:22
If i have a CSV file with the headings First Name, Last Name, Full Name, User Name, Description (Which has been export from Domain A) is there a way i can use powershell to create User accounts in Domain B with this information. The password for all users can be set to Password.
Account will be created in the Administrative > Accounts OU.
I normally do this via DSADD but takes a long time to format the data. null
You can Import-Csv and pipe that to New-ADUser.by Dios_007 at 2012-10-24 05:09:45
You need to be on a domain controller or a computer with RSAT installed.
If that’s not possible I guess you can do the same with Quest AD-cmdlets, which you can download from their website.
Another option is to create a loop with [ADSI]‘LDAP://’ provider but that’s a lot more work.
Yes i have access to the domain controller in my test area.by Klaas at 2012-10-24 06:21:51
I have change the headings to have no spaces FirstName, LastName, FullName, UserName, Description (Not sure if i had to do this)
I have worked out the below so far think its right, how would i go about statiting the default password for all accounts and the OU the accounts will be created in.
Import-CSV c:\Input.csv | ForEach { New-ADUser -GivenName $.FirstName -Surname $.LastName -DisplayName $.FullName -sAMAccountName $.UserName -Description $_.Description }
I can’t test this myself, but I believe that if you give the AD property names as header in the .csv, you don’t need the foreach, so you can justby Ramrod at 2013-02-15 05:24:41import-csv yourcsv.csv | new-aduser -AccountPassword "1234" -Path "OU=yourOU,DC=yourdomain,DC=com"
Please doGet-Help New-ADUser -full | more
to read all about the parameters and which accept pipeline input.
Just put any string related parameter in a text file and save it as .csv. Put the user information in the lines below.
Next step:
import.csv your.csv | new-aduser
Remember that you can put any non-string parameter [bool,int etc.] after the new-aduser cmdlet.