0 votes

Hello,

i have an powerhell variable that contains a hashtable. Is there a way to add the content of this hashtable to an adm-CustomAttributeTextMultiValue of a user?

I tried the following, but it's not working:

Set-ADmUser -identity $sam -add @{"adm-CustomAttributeTextMultiValue1"=$hashtable} -AdaxesService localhost

Thanks for your assistance!

by (130 points)
0

Hello,

Unfortunately, it cannot work like that as each value of a multi-valued attribute must be a string. Could you, please, provide us with an example of the hash table you have and how exactly you need to save values to adm-CustomAttributeTextMultiValue1?

Also, please, specify where the script will be executed (e.g. in a custom command, outside of Adaxes, etc.).

0

Hello,

i would like to use it in a custom command.

The hash table looks somehow like this:

Name                           Value
----                           -----
UserPrincipalName              user@domain.com
TwoWayVoiceMobile              False
DisplayName                    User, Name
PhoneAppNotificationIsDefault  True
PhoneAppOTP                    False
AuthPhoneNumber                +49 160 1234567
AuthAltPhone
AuthEmail
PhoneAppOTPIsDefault           False
PhoneDeviceName                {iPhone, iPhone}
ObjectID                       as04654-sdd-e104-0815-4711
PhoneAppNotification           True
State                          Disabled
TwoWayVoiceMobileIsDefault     False
OneWaySMSIsDefault             False
OneWaySMS                      True

It would be nice to have it in the CustomAttributeTextMultiValue1 row per row with Name: Value., i.E.:

UserPrincipalName:  user@domain.com
TwoWayVoiceMobile:  False
DisplayName: User, Name

Thanks a lot

0

Hello,

Thank you for the provided details. For us to help you with a solution, please, provide the full script you are using in TXT format.

1 Answer

0 votes
by (270k points)

Hello,

In case if you have a general hash table (e.g. specified in a script variable), you can use the below script to save the key-value pair from the table into an Adaxes custom multi-valued attribute.

$hashTable = @{
    "key1" = "value1";
    "key2" = "value2";
    "key3" = "value3";
}

# Convert hash table into array
$array = $hashTable.GetEnumerator() | %% {"$($_.Key): $($_.Value)"}

# Update the target user
$Context.TargetObject.PutEx("ADS_PROPERTY_UPDATE", "adm-CustomAttributeTextMultiValue1", $array)
$Context.TargetObject.SetInfo()

Related questions

0 votes
1 answer

Dear Can I use more than ten adm-CustomAttributeTextMultiValue in Adaxes? Sincerly

asked Jun 29, 2020 by hilmiemrebayat (120 points)
0 votes
1 answer

Hi We need to generate random employee numbers for test accounts, but these need to be between 80000 & 90000 to ensure they are identified as test. Is it possible to do this using just the %adm-RandomInteger% value reference? Thanks Matt

asked Mar 8, 2022 by chappers77 (2.0k points)
0 votes
1 answer

In our environment, we have many business rules with "Add to group". Now I have to delete the "Add to group xyz" in all business rules, as the group is now rule-based. Is there ... in Adaxes so that I don't have to search for and delete all "Add to group xyz"?

asked Mar 7 by DRiVSSi (240 points)
0 votes
1 answer

Is it possible to grant selected user option to add custom license plan (or just subset of its licenses) to given user(s) using web interface?

asked Feb 28, 2023 by KIT (910 points)
0 votes
1 answer

Hi, Is there a way I can create a rule based group or scheduled task in which the Direct reports of the direct reports are added to a group? So for example: CEO VP's ... in the list that no longer reports to a manager who reports to the CEO. Thanks in advance

asked Dec 22, 2022 by gareth.aylward (180 points)
3,326 questions
3,026 answers
7,727 comments
544,679 users