1

My problem is that i don't know how to address my custom Attributes in AD Powershell

I normally user something like this

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

However when i try to set a value to my custom attribute such as

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

I receive this error:

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

Any help would be much appreciated.

1 Answer 1

2

You need to use the -OtherAttributes parameter.

Quoting directly from the documentation here: https://learn.microsoft.com/en-us/powershell/module/activedirectory/new-aduser?view=winserver2012-ps

To set the value of a custom attribute called favColors that takes a set of Unicode strings, use the following syntax:

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

To set values for favColors and dateOfBirth simultaneously, use the following syntax:

-OtherAttributes @{'favColors'="pink","purple"; 'dateOfBirth'=" 01/01/1960"}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.