Gentlemen,
This little script is working however the password and the user wont be "enabled" and "pswd never expires" won't be true after running script, could you please drop me a hint why?
The code:
Import-CSV c:ScriptsContent.csv | New-ADUser
-EmailAddress $_.EmailAddress
-GivenName $_.GivenName
-Surname $_.Surname
-DisplayName $_.DisplayName
-Name $_.Name
-SamAccountName $_.SamAccountName
-Description $_.Description
-Department $_.Department
-EmployeeID $_.EmployeeID
-Path $_.Path
-Password $_.Password
-Enabled $True -AccountPassword (ConvertTo-SecureString $_.Password -AsPlainText -force)
-PasswordNeverExpires $true
Example of the CSV file:
GivenName,Surname,Name,DisplayName,SamAccountName,Description,Department,EmployeeID,Path,Enabled,EmailAddress,Password,PasswordNeverExpires
First01,Secon01,Player01,Incredible_Hulk,Player01@uku.group,Player,Psngame,12312,"OU=TestUsers,DC=psn,DC=group",$True,hello01@psn.group,p@ssword,$True