I would like to add DispalyName and Password never changes (I did not add this attribute) to PS script. This script will add users from a csv file from excel. Here is my script. It works except when I add the DisplayName I get an error.
Import-Module ActiveDirectory
Import-Csv "C:\Scripts\NewUsers.csv" | ForEach-Object {
$userPrincinpal = $_."samAccountName" + "@doman.Local"
New-ADUser -Name $_.Name `
-Path $_."ParentOU" `
-SamAccountName $_."samAccountName" `
-UserPrincipalName $userPrincinpal `
-AccountPassword (ConvertTo-SecureString "12345678" -AsPlainText -Force) `
-ChangePasswordAtLogon $true `
-Enabled $true
-DisplayName $_."DisplayName"
Add-ADGroupMember "Students" $_."samAccountName";