0 votes

I'm creating a powershell script to handle all the 'modify user' steps, instead of having them be individual steps in Adaxes. This script runs after we fill out a form.

A few of the parameters are set to "Allow empty value", but also require you to choose one of many choices available in a dropdown list if the value is not blank.

When I fill out the form and leave this field blank the powershell script runs, but the value of the parameter (%param-practice%) is considered as : "(space)(space)(space)(space)" (4 spaces) and so adaxes returns an error stating that the value must be chosen from the dropdown menu.

Specifically, here is a portion of the script.

#Set account attributes to values specified in the input form
Set-AdmUser -Identity %sAMAccountName% -Replace @{

    [...]

    #Second Practice (FR)
    "adm-CustomAttributeText11"=("%param-Practice2%");

    [...]

    } -AdaxesService localhost

Why is an empty parameter considered as either a "tab" or "4 spaces" ?

Thanks for your help.

by (130 points)
0

Hello,

We were not able to reproduce the behavior. Value references for empty parameters resolve into an empty string. Are you sure that the value is not set for the parameter as default? Please, provide us with screenshots of the parameter configuration. You can post them here or send to us at support@adaxes.com.

0

Hi, thanks for the reply.

Ok, maybe the spaces or "tab" or whatever it is comes from the way Adaxes prints out the parameter when I include Write-Warning "%param-practice2%".

The warning message displays as an empty space with a yellow exclamation point.

Why then, if that is indeed an empty string, am I not able to assign an empty string to a property though powershell?

Consider the following :

#In this example, %param-Practice2% is empty. 

Set-AdmUser -Identity %sAMAccountName% -Replace @{

    #Second Practice (FR)
    "adm-CustomAttributeText11"=("%param-Practice2%");

    } -AdaxesService localhost

The error message I get is specifically :

Processeur de modèles de propriétés: La propriété 'Seconde pratique' ne satisfait pas à la contrainte suivante: doit être l'un de: 'value1', 'value2', 'etc...'

which translates to :

Processor of property models : The property 'Second practice' does not satisfy the following constraint : Must be one of : 'value1', 'value2', 'etc...'.

How does Adaxes assign empty strings to properties when using the 'Modify user' action?

Is there some internal mechanism that checks each value being assigned to each property, and it skips over empty values?

Thanks for the help.

Louis

1 Answer

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

Hello,

The issue occurs because there is a property pattern configured. It states that only the values you see in the error are allowed. It means that that passing an empty value to the property is prohibited. This behaviour is expected and is not related to the modify action or any other internal mechanisms. It is just that you configured Adaxes to work like that with this property. For information on how the settings are configured, have a look at the following tutorial: https://www.adaxes.com/help/MakeInputFieldDropDownList.

For your information, it is recommended to use the $Context.LogMessage method to make outputs in Adaxes scripts.

0

Hello,

Clearly, there is something I don't understand.

Why then, when using the adaxes feature 'Update the user' am i able to assign empty values to this property?

2022-12-15 08_45_08.png

2022-12-15 08_47_57.png

The seven properties highlighted by the red rectangle all receive empty values when using the 'Update the user' feature, but when using powershell and assigning empty values to them, I get the above-mentionned errors.

As per the first screenshot, they are all configured with the 'The property is required' box unchecked.

I ask again, how does Adaxes handle assigning empty values when using the 'update the user' method, and why can I not assign empty strings through powershell ?

Thanks for your help with this.

0

Hello,

There is basically no difference in the approaches whenever you make changes through Adaxes. If an update does not include a property and the property is not required, it will just be left empty. However, if you attempt to pass an empty value to a property with predefined list of allowed values, you will get the error in both cases.

Keep in mind that property patterns used to define the lists of allowed property values have a scope. It means that a certain property pattern can apply to specific objects, but not the others. As a result, you might be able to set a property to an empty value for one user and receive the error for another.

0

If an update does not include a property and the property is not required, it will just be left empty.

So behind the scenes, it's basically

if(empty){ skip } else { don't skip } 

correct?

That makes more sense, considering the only way I got around it was to make a switch for all my optional parameters in order to not pass an empty value to the property.

Thanks for the help.

+1

Hello,

So behind the scenes, it's basically

That is no quite correct. There is no skip. The property is just not present in the request. As a result, there is no check for it against property patterns.

That makes more sense, considering the only way I got around it was to make a switch for all my optional parameters in order to not pass an empty value to the property.

Yes, that should work just fine.

Related questions

0 votes
1 answer

I am upgrading to version 2013-2 and I have found an issue with default field values. I'm hoping you can assist me with this. Web Filtering Level is associated ... recognized: Also note that one of the custom fields hints data bleeds into the field value.

asked Dec 12, 2013 by BradG (950 points)
0 votes
1 answer

Hello, We have a problem with the way Adaxes detects % as variables in all PowerShell scripts. We are configuring a HTML email template for all out going emails from the system ... this is a start of a variable. Is there anyway around this? Regards, ice-dog

asked Feb 22, 2019 by ice-dog (170 points)
0 votes
1 answer

Hi team, I would like to update allowed values of a property pattern and found this script: https://www.adaxes.com/script-repository/add-new-allowed-property-value-to-a- ... multiple new values? I tried already a foreach around it, but not working properly :/

asked Sep 2 by wintec01 (1.5k points)
0 votes
1 answer

Recently, Microsoft deprecated use of the remote PS sessions using version 1. We have since converted all of our scripts to version 2, but our nightly staff ... { # Close the remote session and release resources Disconnect-ExchangeOnline -Confirm:$false }

asked Nov 2, 2022 by MShep (80 points)
0 votes
1 answer

what version of powershell is needed with modern auth and connect to 0365/azure

asked Sep 30, 2022 by sra98a (120 points)
3,547 questions
3,238 answers
8,232 comments
547,809 users