简体   繁体   中英

How can I change the display name in Active Directory with powershell?

How can I change the Name attribute in Active Directory in powershell?

在此处输入图片说明

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM