[英]How can I change the display name in Active Directory with powershell?
How can I change the Name attribute in Active Directory in powershell? 如何在Powershell的Active Directory中更改Name属性?
I would like to change the 'Name' row, but when I enter the following I get an error: 我想更改“名称”行,但是当我输入以下内容时出现错误:
Set-ADuser -Identity test1 -Name Test 11
The error message: 错误信息:
Set-ADUser : A parameter cannot be found that matches parameter name 'Name'.
At line:1 char:28
+ Set-ADUser -Identity test1 -Name Test 11
+ ~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-ADUser], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.ActiveDirectory.Management.Commands.SetADUser
您应该使用cmdlet Rename-ADObject更改AD对象的名称属性。
如果您想一次更改一个帐户的多个属性(例如更改用户名),则将PassThru
参数添加到Set-AdUser
,然后通过管道传递到Rename-ADObject
:
Set-ADUser -Identity "test1" -DisplayName "DisplayName" -GivenName "GivenName" -Surname "Surname" -PassThru | Rename-ADObject -NewName "TestAccount1" -PassThru
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.