0 votes

Hi,

I'd like to implement a rule to ensure that telephoneNumber value is unique accross the domain for each user, either after creation or updates.
I tried to implement a business rule (powershell script) before user update, but the problem is that the telephoneNumber provided thru the %telephoneNumer% token is the old one (before change). How to get the new value in the script ?

Thanks

Stephen

by (800 points)

1 Answer

0 votes
by (18.0k points)

Hello,

At the moment it is possible validate AD object properties using a script only before creation of an object. For details, please see Checking EmployeeID

In a week, we are going to release a minor release that will allow validating object properties before updating objects in AD. As soon as the new version is released, I'll post here instructions on how to do what you need.

0

Thanks you.

I'll be patient :-)

0

Hello,

Yesterday we released Adaxes 2011.2 that allows you to validate user input using scripts.
To validate that the specified telephone number is unique in the directory, you need to create a Business Rule that will be triggered before creation of new users in AD. This Business Rule should execute the following PowerShell script:

Import-Module Adaxes
if ($Context.IsPropertyModified("telephoneNumber"))
{
    # Get the value specified by the user
    $value = $Context.GetModifiedPropertyValue("telephoneNumber");
    # Ensure that the specified phone number is unique
    if ((Get-AdmUser -Filter 'telephoneNumber -eq $value') -ne $NULL)
    {
        $Context.Cancel("A user with the specified telephone number already exists!");
        return;
    }
}

For more details, see Validate/Modify User Input Using a Script.

You can download Adaxes 2011.2 here.

0

Hello,

In your script you are checking an attribute of the AD. I want to check if an attribute of Adaxes (adm-Custom...) has changed and if its unique. How do I have to change the code, that it works for Adaxes custom attributes?

Thx

0

Hello,

You will need to totally rework the if statement part. The thing is that you cannot use Adaxes custom attributes in search criteria. As such, the only option is to find all the managed users and then check the attribute value separately for each of them. Unfortunately, we do not have the exact example, but the following article should be helpful: https://adaxes.com/sdk/SampleScripts.SearchingUserAccounts.

Related questions

0 votes
1 answer

We want to check, if the number of a new team (group) is unique. The number is stored in the attribute "gidNumber". I have a business rule executing before creating ... $NULL) { $Context.Cancel("Ein Team mit dieser Team-Nummer existiert bereits!") return } }

asked Oct 13, 2020 by lohnag (160 points)
0 votes
1 answer

Hello, I have a web service that checks if a user is a member of a group. I am not concerned if they are a direct member or an indirect member of a group, but if the user is in the ... I pass it User A and Group 1. I am using ADSI, c# (.Net 4.0), and WCF.

asked Feb 23, 2014 by mbcalvin (140 points)
0 votes
0 answers

Say you have Manager A that has 30 users under them. Manager A leaves and Manager B takes the position. What is the best way to update all 30 users so their new manager is Manager B.

asked Jun 7, 2021 by Jmbrown04 (60 points)
0 votes
1 answer

For creating a computer object, we want to check if the entered CN is already used in our AD. And for that we want to use a powershell script. An other dot ... powershell script should be start before creating the computer object, right? Thanks for your help.

asked Jun 4 by KEME (80 points)
0 votes
1 answer

So this works for us however we would like to add to check if the last group is at 3 users we would like to send a seperate email but would still like all the above to continue to happen the way it is.

asked Mar 2, 2022 by Keonip (180 points)
3,548 questions
3,238 answers
8,232 comments
547,811 users