I'm guessing there is some limitation with LDS as I can't add samaccountname when running the following command:
new-aduser -samaccountname "bobman" -name "bobtest" -server "localhost" -path "OU=Users,DC=test,DC=local"
A new user account is created on LDS but the samaccountname property remains blank.
Running the above command on a full instance of AD creates the user and samaccountname successfully which makes me think this is a limitation with LDS or thers another way to add it.
Is there a way around this as I'd like to populate samaccountname on LDS?
The above command isn't the full command in my script as that reads from a CSV file and creates a list of users so I produced a basic command to only populate a few fields to test it out.
Thanks in advance.
I found some pages online which confirmed new-aduser does not have the ability to add a value for samAccountName as it is not in the LDS schema.
To get around this issue I have wrote a script which generates a LDF file with content as follows for each user:
dn: CN=Bob Test,OU=Users,DC=Server,DC=local
changetype: modify
replace: samAccountName
samAccountName: bobman
-
I then used LDIFDE to run the above LDF file which populated samAccountName successfully.