Here is my code and for some reason it wont add it in. Seems to work but the users are not listed. Import-Csv .\users1.csv { foreach-object $userprinicpalname = $_.SamAccountName + "@XXXXXX" ; New-ADUser -SamAccountName $_.SamAccountName
-UserPrincipalName $_.userprinicpalname -Name $_.name -EmailAddress $_.E-Mail -DisplayName $_.Name -GivenName $_.FirstName -SurName $_.LastName -replace @{msnpallowdialin=$true} -Path $_.path; Set-ADAccountPassword -identity $_.SamAccountName -NewPassword
(ConvertTo-SecureString -AsPlainText $_.Password -Force) ; Enable-ADAccount -identity $_.SamAccountName; Set-ADUser -Identity $_.SamAccountName -ChangePasswordAtLogon $true }
↧