Creating user from template in powershell - Server 2012 R2
i've been research online how create user template in powershell , far can't work. here i'm using:
$instance = get-aduser –identity template_user new-aduser –samaccountname test_scripts –instance $instance –name “test scripts” –enabled:$false
i'm getting error saying operation failed because upn value not unique. this strange error me, because saying "-instance" account. but of course 1 isn't unique. that's template. if remove "-instance $instance" code, works fine , creates account, not template, obviously.
any ideas? below entire pasted error.
new-aduser : operation failed because upn value provided addition/modification not unique forest-wide@ line:1 char:1
+ new-aduser –samaccountname test_scripts –instance $instance –name “test scripts” ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ categoryinfo : notspecified: (cn=test scripts...domain,dc=com:string) [new-aduser], adexception
+ fullyqualifiederrorid : activedirectoryserver:8648,microsoft.activedirectory.management.commands.newaduser
hi,
you'll need supply unique upn new user adding in -userprincipalname parameter.
http://ss64.com/ps/new-aduser.html
don't retire technet! - (don't give yet - 13,225+ strong , growing)
Windows Server > Windows PowerShell
Comments
Post a Comment