Answer the question
In order to leave comments, you need to log in
AD PowerShell error in code?
Please tell me who knows.
Import-Csv "C:\users.csv" -Delimiter ";" | ForEach-Object {
$upn = $_.SamAccountName + “@nfbgu”
$uname = $_.LastName + " " + $_.FirstName
New-ADUser -Name $uname `
-DisplayName $uname `
-GivenName $_.FirstName `
-Surname $_.LastName `
-EmailAddress $_.EmailAddress`
-UserPrincipalName $upn `
-SamAccountName $_.samAccountName `
-Path $_.OU `
-AccountPassword (ConvertTo-SecureString $_.Password -AsPlainText -force) -Enabled $true
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question