# Script:
Import-Csv .\Users.csv | ForEach {New-ADUser -SamAccountName $_.SamAccountName -UserPrincipalName $_.UPN -GivenName $_.FirstName -Name $_.Name -DisplayName $_.DisplayName -Surname $_.LastName -Department $_.Department -AccountPassword (ConvertTo-SecureString "Password@123" -AsPlainText -Force) -Enabled $true -ChangePasswordAtLogon $true -PassThru -Path $_.Path}
# CSV File Format:
FirstName
|
Name
|
LastName
|
DisplayName
|
SamAccountName
|
UPN
|
Path
|
Department
|
Ajay
|
Ajay Kakkar
|
Kakkar
|
Ajay Kakkar
|
ajayk
|
ajayk@WIN2K8.COM
|
OU=Test,DC=WIN2K8,DC=COM
|
IT
|
No comments:
Post a Comment