0 votes

What would the PowerShell command be to modify a CustomAttribute field?

For example, if I wanted to modify a user and change adm-CustomAttributeText1 to be the contents of $HomeEmail?

by (1.1k points)

1 Answer

0 votes
by (216k points)
selected by
Best answer

Hello,

You can update custom attributes the same as updating any other properties of AD objects. Note, however, that you are able to modify Adaxes custom attributes only when operations are performed via Adaxes service. That is, for this purpose, you'll need to use either cmdlets from Adaxes powerShell module or Adaxes ADSI API.

If you are using Adaxes PowerShell Module, you can call the Set-AdmUser cmdlet for this purpose and specify the -AdaxesService parameter when calling it, for example:

Set-AdmUser "CN=John Doe,CN=Users,DC=example,DC=com" -Add @{"adm-CustomAttributeText1"=$HomeEmail} -AdaxesService localhost

If you prefer using the ADSI API, you can do as follows:

$user = $admService.OpenObject("Adaxes://CN=John Doe,CN=Users,DC=example,DC=com", $NULL, $NULL, 0)

$user.Put("adm-CustomAttributeText1", $HomeEmail)
$user.SetInfo()
0

Thanks! Worked great!

I think I was missing the "-AdaxesService localhost" at the end of the command.

0

why can't we do the same with get-admuser?

0

Hello,

The Get-AdmUser cmdlet is used only for getting Active Directory users, not for updating which is done using the Set-AdmUser cmdlet. For more details, have a look at the following SDK articles:
Get-AdmUser
Set-AdmUser

Related questions

0 votes
1 answer

Is it possible to create additional CustomAttribute Fields? I only recently started using Adaxes so I don't want to use them unnecessarily if it is limited to the existing fields.

asked Apr 22, 2016 by Kikaida (1.1k points)
0 votes
1 answer

Hello, I have a simple custom command that need to update the ProfilePath of Remote Desktop Services only if the current Profilepath starts with a specific value. I use the If ... the result is never true so the value is not updated. Thanks in advance. Ten

asked Dec 3, 2019 by tentaal (1.1k points)
0 votes
1 answer

Receive "Index operation failed; the array index evaluated to null. Stack trace: at <ScriptBlock>, <No file>: line 104>" and "Index operation failed; the ... $GroupName, $GroupDN." } } #foreach write-output "" Write-Output "" Stop-Transcript

asked Apr 14, 2022 by jbahou (20 points)
0 votes
1 answer

I would like to know how to connect to Azure AD using Adaxes. I've already followed the instructions to connect to AAD using an application ID for Adaxes, but how can I ... place as the script is executed, much like what you see in a normal Powershell command?

asked Sep 2, 2022 by andreashalkias (50 points)
0 votes
1 answer

Hello, I'm trying to execute a custom command through a Powershell script, but I'm struggling to pass multiple values to an AD Object Picker parameter. ... , $NULL, $NULL, 0) $obj.ExecuteCustomCommand($command.CommandID, $commandArguments) Thanks in advance!

asked Nov 24, 2021 by KelseaIT (320 points)
3,346 questions
3,047 answers
7,782 comments
544,986 users