广告自定义属性新aduser powershell



我的问题是我不知道如何解决我的自定义属性

我通常用使用类似的东西

New-ADUser -Name "Test" -surname "User" -description "User Description"

但是,当我尝试为我的自定义属性设置值时,例如

New-ADUser -Name "Test" -surname "User" -description "User Description" -reportingManagerID "012345"

我收到此错误:

New-ADUser : A parameter cannot be found that matches parameter name 'reportingManagerID'.
At line:1 char:247
+ ... " -StreetAddress "address" -Surname "User" -reportingManagerID "1234"
+                                                ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [New-ADUser], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.ActiveDirectory.Management.Commands.NewADUser

任何帮助都将不胜感激。

您需要使用-OtherAttributes参数。

直接从文档引用:https://learn.microsoft.com/en-us/powershell/module/module/activeirectory/new-aduser?view=winserver2012-ps

设置称为favcolors的自定义属性的值,该属性采用一组Unicode字符串,请使用以下语法:

-OtherAttributes @{'favColors'="pink","purple"}

要同时设置favcolors和dateofth的值,请使用以下语法:

-OtherAttributes @{'favColors'="pink","purple"; 'dateOfBirth'=" 01/01/1960"}

最新更新