0 votes

In our organization, we have two domains.

Is there a way to create a rule to check the other domain if the account exists before creating the account?

by (1.1k points)

1 Answer

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

Hello,

Yes, this is possible. You can create a Business Rule triggered before creating a user that will check whether a user with the specified username already exists in your domains. If a user with such a user name already exists, the Business Rule will cancel user creation. For information on how to create such a Business Rule, take a look at the Validate/Modify User Input Using a Script Tutorial. On the 5th step of the tutorial, paste the following script:

# Get user name
$username = $Context.GetModifiedPropertyValue("sAMAccountName")

# Search all users
$searcher = New-Object "Softerra.Adaxes.Adsi.Search.DirectorySearcher" $NULL, $False
$searcher.SearchParameters.PageSize = 500
$searcher.SearchParameters.SearchScope = "ADS_SCOPE_SUBTREE"
$searcher.SearchParameters.Filter = "(&(objectCategory=user)(sAMAccountName=$username))"
$searcher.VirtualRoot = $True

$result = $searcher.ExecuteSearch()
$users = $result.FetchAll()
$result.Dispose()

# Check if the user name is unique
if($users.Count -ne 0)
{
    $Context.Cancel("A user with the specified user name already exists.") # TODO: Modify me
}
0

Worked great!

Related questions

0 votes
1 answer

Hello, I need to check, from a csv file, if users exist or not. I do not have the login name but only the atributs Name givenName The output must be another csv file ... " --> False or True Is there an Adaxes script existing doing this? Thanks in advance!

asked Feb 4, 2019 by tentaal (1.1k points)
0 votes
1 answer

Hello, Based on your script, we check whether there is already a request. However, we often get the following error and do not know why. Can you help us? ... Cannot compare "Softerra.Adaxes.Adsi.Search.AdmSearchResult" because it is not IComparable. Thank you

asked Apr 16 by DRiVSSi (320 points)
0 votes
1 answer

and script is but nothing is happeneing. my user in adaxe browwser has the attribute to yes

asked May 10, 2023 by fjacques (20 points)
0 votes
1 answer

Hallo everyone, I'm new to this Forum and I hope that someone can help me. My Environment: - Adaxes Backend Service and Web Frontend running on different mashines. - The backend ... I change the scope of objects :?: Question: Can someone help me? Thanks a lot.

asked Apr 28, 2015 by ATiedemann (360 points)
0 votes
1 answer

I have a created a powershell script that imports users in to Active Directory, creates a result file, archives the CSV and the result file, and e-mails specified users when with ... but I'm very new to Powershell and I have no idea where to begin. Thanks!

asked Jan 24, 2014 by rlsparks (130 points)
3,588 questions
3,277 answers
8,303 comments
548,090 users