Issue with New-ADUser
Hi Paul,
Using the power shell script that you taught, I was able to create multiple accounts in AD, but not able to login with those accounts, try creating a new account in AD & that works fine. So I check the properties of both accounts, what I found that script does not have anything about post Window 2000, so the accounts were created by the script is missing Period in the login, because of that I was not able to login. So all I did was put the period & it work like charm.
Thanks for your teaching it helps me lot.

1 Like

Hey Syed,

Thanks for your feedback. Do you have the command on hand? Its possible the syntax has been changed since the recording.

Iā€™d like to update the lecture docs accordingly.

@syed.sharieff You sent me this code VIA email:

# Import AD Module
Import-Module ActiveDirectory
#grab variables from user
$firstname = Read-Host -Prompt "Please enter the first name"
$Lastname = Read-Host -Prompt "Please enter the first name"
# Create the AD User
New-ADUser `
-Name "Sam Don" `
-GivenName "Sam" `
-Surname "Don" `
-UserPrincipalName "Sam.Don" `
-AccountPassword (ConvertTo-SecureString "Password1" -AsPlainText -Force) `
-Path "OU=Domain User,,DC=acs,DC=edcc,DC=ctc,DC=edu)" `
-ChangePasswordAtLogon 1 `
-Enabled 1

This will work, but you should substitute the fixed values for the variables $firstname and $lastname on these lines

So try this in your New-ADUser command:

-Name "$firstname $Lastname " `
-GivenName "$firstname" `
-Surname "$Lastname" `
-UserPrincipalName "$($firstname).$($Lastname)" `