Importing new users with .csv file
i'm having issues importing csv file. here headings of has been given me in csv file.
givenname sn displayname office description userprincipalname samaccountname parentcontainer password email login script connect to
i tried doing on 1 powershell new-aduser , can't seem working either. this got.
new-aduser -name "lastname, firstname" -givenname firstname -surname lastname -displayname "lastname, firstname" -office 111111 -description "class of 2025" -userprincipalname username@email.com -samaccountname flastname -path "ou=orgunitsample,dc=domain,dc=org" -accountpassword (convertto-securestring passwordhere -asplaintext -force) -emailaddress username@email.com -scriptpath login.bat -homedirectory \\servername\share\username-enabled $true -homedrive x: -cannotchangepassword $true -changepasswordatlogon $false -passwordneverexpires $true new-aduser : directory object not found
@ line:1 char:1
+ new-aduser -name "lastname, firstname" -givenname firstname surname lastname
-dis ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ categoryinfo : objectnotfound: (cn=username\, ...c=domain,dc=o
rg:string) [new-aduser], adidentitynotfoundexception
+ fullyqualifiederrorid : activedirectorycmdlet:microsoft.activedirectory.
management.adidentitynotfoundexception,microsoft.activedirectory.managemen
t.commands.newaduser
regarding attempt create 1 user, of values of string attributes should quoted, unless retrieve values csv in pipeline. not apply boolean attributes. check new-aduser. has examples values specified in attempt:
https://technet.microsoft.com/en-us/library/ee617253.aspx
also, if want user created in parentcontainer, use -path parameter of new-aduser specify this.
richard mueller - mvp enterprise mobility (identity , access)
Windows Server > Windows PowerShell
Comments
Post a Comment