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

Thanks for the info. I'm now grabbing the %adm-ManagerUserName% value, but need to remove the final 21 characters of it so it contains only their username and not our ... this in the PowerShell Script Editor for my business rule, I get the following error:

asked Mar 11, 2021 by mkvidera (60 points)
0 votes
1 answer

We've the following script we want to use in Adaxes to create as part of user creation, to ask if the user will need a AWS workspace, then asks employeetype for different ... "Error") exit(-1) } else { $Context.LogMessage("Created workspace", "Information") }

asked May 3 by Plusa (20 points)
3,549 questions
3,240 answers
8,232 comments
547,820 users