active-directory – New-ADUser -Name Length太长
发布时间:2021-01-12 02:01:53 所属栏目:Windows 来源:网络整理
导读:我需要向AD中的OU添加大约500个用户 我编写了我需要的所有内容,然而,它给出了错误: 提供的名称不是正确形成的 这是脚本 New-ADUser -Name C080CAB1-9756-409F-914D-AE3971F67DE7 -Path "OU=Staging,DC=domain,DC=local" -accountPassword (convertto-secure
我需要向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之前的登录被截断,但用户登录名不是 http://thenerdservice.com/userlogin.png (编辑:ASP站长) 【免责声明】本站内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。 |
相关内容
未处理完善
-
无相关信息
最新更新