0 votes

Hi,

I am looking for a solution which checks if the username ist unique with the following requirements:

If [first letter of first name].[last name]

is not possible as username then

  1. Try full name:

[first name].[last name]

if not possbile try

  1. middle name:

[first name].[other given name].[last name]

if not possbile try

  1. last name only:

[last name]

if not possbile try

  1. add number

[first letter of first name].[last name]2

I' am looking forward to a hint. Thanks

by (510 points)

1 Answer

0 votes
by (274k points)

Hello Boris,

Have a look at the following tutorial: https://www.adaxes.com/help/ValidateModifyUserInputWithScript. Also, the following script from our repository might be helpful: https://www.adaxes.com/script-repository/automatically-add-a-digit-to-the-username-if-it-is-not-unique-s298.htm. If you face issues writing the script yourself, please, specify the following:

  • What exactly do you mean by add number? Should it be done once or until the username becomes unique?
  • What should be done if a unique username cannot be formed?

Any additional details will be much appreciated.

0

Hello Boris,

You can use the following approach:

$addressTemplate = %username%@company.mail.onmicrosoft.com"

As the script for unique username generation is executed before users are created, the value reference will result into the final username the account is actually created with.

0

OK now I get it, thanks.

0

It's not often that the script is used, so I'm just getting back to you. In case of the change to "%firstname:lower%.%lastname:lower%" (2nd approach) there is always the problem that the following business rules don't work anymore, because the UPN is then always "firstname.lastname@" without domain ending
In this case there seems to be an error in the script, can you reproduce this?Unbenannt.jpg****

0

Hello Boris,

Sorry for the confusion, but with the current screenshot we are not able to provide any insight on the issue. If you cannot post an uncovered screenshot here, please, send it to us at support@adaxes.com. Also, please, send a screenshot of the business rule itself.

Additionally, please, specify the version of Adaxes you are currently using (including the build number). For details on how to check it, see https://www.adaxes.com/help/CheckServiceVersion.

0

Hello Boris,

Thank you for the provided details. Unfortunately, there was a mistake in the script. To fix it, replace this line in the script

$localPart, $domainPart = $username.Split("@")

with the below one

$localPart, $domainPart = $userPrincipalName.Split("@")

We also update the script in the above post as well.

Related questions

0 votes
1 answer

Hello, I hope someone can help me with a specific script. I have tried to put 2 or 3 together that I have found on here but not having much luck. I am looking to have a ... -upn, but it doesn't seesm to be quite what I'm after. Any help would be appreciated.

asked May 20, 2020 by adantona (40 points)
0 votes
0 answers

Has anyone ever had the business requirement that the usernames of new users be unique across all of the managed domains in the environment? It is easy enough to run a ... the run as service account understand to look further into the other domains as well?

asked Jul 22, 2016 by strikk (360 points)
0 votes
1 answer

Hello, Currently we are using the script from another topic to add a number to the username counting up until it finds a unique name. However, we need the username to still ... changed to " + $userLogonName ` + ".", "Information") Thanks for the assistance.

asked Feb 9, 2016 by jhair (520 points)
0 votes
0 answers

We have a process to create unique usernames but it doesn't account for hyphens. We would like to remove the hyphens and continue to use first initial plus the first seven characters from the ... ($UNLT - 1), $UN.Length)) $UNName + ([int]$UNNum + 1) } } }

asked Dec 11, 2015 by tcarp (20 points)
0 votes
1 answer

Hello, Im using a business rule triggered before a new user is created to check for username uniqueness. Our company continues to add characters from the first name to build out a ... first name backwards. Like Jdoe, oJDoe, hoJDoe. What can I do to fix this?

asked Nov 18, 2015 by lasership (370 points)
3,383 questions
3,082 answers
7,832 comments
545,476 users