我需要向AD中的OU添加大约500个用户
我编写了我需要的所有内容,然而,它给出了错误:
提供的名称不是正确形成的
这是脚本
New-ADUser -Name C080CAB1-9756-409F-914D-AE3971F67DE7 -Path "OU=Staging,DC=domain,DC=local" -accountPassword (convertto-securestring "zagreb+scotch8355" -asplaintext -force) -PasswordNeverExpires $True -CannotChangePassword $false -Enabled $true
我跑了几个测试以确定问题是什么:
New-ADUser -Name "C080CAB1-9756-409F-914D-AE3971F67DE7" -Path "OU=Staging,DC=local" -accountPassword (convertto-securestring "zagreb+scotch8355" -asplaintext -force) -PasswordNeverExpires $True -CannotChangePassword $false -Enabled $true New-ADUser -Name 'C080CAB1-9756-409F-914D-AE3971F67DE7' -Path "OU=Staging,DC=local" -accountPassword (convertto-securestring "zagreb+scotch8355" -asplaintext -force) -PasswordNeverExpires $True -CannotChangePassword $false -Enabled $true New-ADUser -Name C080CAB1`-9756`-409F`-914D`-AE3971F67DE7 -Path "OU=Staging,DC=local" -accountPassword (convertto-securestring "zagreb+scotch8355" -asplaintext -force) -PasswordNeverExpires $True -CannotChangePassword $false -Enabled $true
以及其他几个变化
做了什么工作:
New-ADUser -Name C080CAB1-9756-409F -Path "OU=Staging,DC=local" -accountPassword (convertto-securestring "zagreb+scotch8355" -asplaintext -force) -PasswordNeverExpires $True -CannotChangePassword $false -Enabled $true
所以我认为这可能是一个长度问题,但我不确定如何使脚本工作.
是否要将名称显示为该36个字符串或登录为36个字符串
如果您使用的是服务器2012 R2,则只能将显示名称设置为20个字符,但登录名称最多可以为64个字符(我认为),使用“-UserPrincipalName”
试试这个
New-ADUser -Name C080CAB1-9756-409F-9 -UserPrincipalName C080CAB1-9756-409F-914D-AE3971F67DE7 -Path "OU=Staging,DC=local" -accountPassword (convertto-securestring "zagreb+scotch8355" -asplaintext -force) -PasswordNeverExpires $True -CannotChangePassword $false -Enabled $true
这将创建显示名称并截断-UserPrincipalName的值,该值将是用户的用户登录名.
请参阅任何用户的属性以设置适当的标志.
http://thenerdservice.com/useradd.png
您可以看到200之前的登录被截断,但用户登录名不是
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。