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 (294k 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

We are wanting to display all values entered into a multi value text attribute in an email sent by Adaxes. What we've found is that only the first entry into the array ... Entry" Is there a way to reference the variable so that it displays all entries? Thanks

asked Dec 12 by msheppard (660 points)
0 votes
1 answer

I want to add a custom column in a report that displays members of a group that shows the age of the user account in days. Is that possible?

asked Oct 23 by msheppard (660 points)
0 votes
1 answer

Is there any way to add a warning message when someone tries to add a group member that already is member? Checked config but found nothing related. Added a new member that ... the group and there is no warning, and the logs show that the task was completed.

asked Jul 9 by lramirez (20 points)
3,589 questions
3,278 answers
8,303 comments
548,122 users