0 votes

Hi - I'm trying to validate that the email address entered is distinct. The logic below is not working.

When we had Exchange, this was automatic. We no longer have Exchange, so email is just the "mail" attribute in Active Directory. I simply want to prevent a user from entering an already present address.

Similar logic to this works just fine with other attributes (employeeid for example).

Import-Module Adaxes  
if ($Context.IsPropertyModified("mail"))  
{  
 # Get the value specified by the user  
 $value = $Context.GetModifiedPropertyValue("mail");  
 # Validate mail  

 # Ensure that the mail is unique  
 if ((Get-AdmUser -Filter 'mail -eq $value') -ne $NULL)  
 {  
 $Context.Cancel("A user with the specified mail address already exists!");  
 return $false;  
 }  
}
by (950 points)
0

Hello,

The script is OK. Can you post here or send us a screenshot of the Business Rule that launches the script? Also, when is the Business Rule triggered, before or after creating/updating a user?

0


You can see that the Business Rule fires, but when tested against a known pre-existing address, it does not flag it as a duplicate. It seems to pass it anyways.

0

How many domains do you have registered in Adaxes? Is Adaxes installed on a computer in the same domain as the user that you are testing with?

1 Answer

0 votes
by (950 points)

Just one. I found my mistake....

I needed to specify "Before Creating a User" on the Business Rule. Thanks for your patience! Once I did this, it works like a champ.

0

Similar question, but targeting groups this time. I'm triggering this before group creation, but it does not seem to catch the duplicates:

Import-Module Adaxes  
if ($Context.IsPropertyModified("Email"))  
{  
 # Get the value specified by the user  
 $value = $Context.GetModifiedPropertyValue("Email");  
 # Validate mail  

 # Ensure that the mail is unique  
 if ((Get-AdmGroup -Filter 'Email -eq $value') -ne $NULL)  
 {  
 $Context.Cancel("A group with the specified Email address already exists!");  
 return $false;  
 }  
}
0

Nevermind - you have to be careful to select the actual attribute name. "mail", not "email".

Thanks!

Related questions

0 votes
1 answer

When creating business rules I quite often find myself having to create overly complex workflows because we can't use ELSE or BREAK statements. An example would be:- ... am I missing something in how to construct business rules that mimics their use? Thanks

asked Sep 23, 2014 by firegoblin (1.6k points)
0 votes
1 answer

Hi Adaxes Support - Currently we have an onboarding form that's used for provisioning new user accounts. The form is used by our HR team. There is also 2 Business ... Modification' rule to only apply for the User Management form and not the Onboarding form.

asked Oct 21, 2020 by 6FigureMission (140 points)
0 votes
1 answer

I'm building my first rule to license users in Office365. When the rule runs it fails to find the Usage Location which is based on the Country (default settings). I ... runs before the "assign 365 license" rule. Why am I not getting Usage Location populated?

asked Jul 20, 2020 by ComputerHabit (790 points)
0 votes
1 answer

My scheduled task currently: Checks for staff in a particular OU that do not have an O365 license Adds a license Resets their AD Password Moves them to an OU based off ... scheduled task moves them out of the OU that the business rule is looking at. Thanks

asked Apr 15, 2020 by russmerriman (40 points)
0 votes
1 answer

According to this article when we disable a user we should "Disable Exchange ActiveSync and Disable OWA for Devices, and Disable email connectivity." However I can only figure ... connectivity" as well? https://support.office.com/en-us/articl ... 5eddb367d1

asked Aug 4, 2015 by auser42 (340 points)
3,326 questions
3,026 answers
7,727 comments
544,679 users