0 votes

image.png

by (1.0k points)
0

Hello,

How exactly are you setting the UPN? Please, describe the process in all the possible details with live examples. If you have scripts involved, please, provide them in TXT format. If there is something you cannot post here, please, send it to us at support@adaxes.com.

0

I use the script I posted in the first question to create the user, if there is no duplicate sam name then the upn is automatically set to samAccountName@MYDOMAIN Example of user who was created through automated CSV. image.png Next So I did what was asked with a business rule to run before creating a user and now the SAM name is fixed and working however the UPN didn't set $htable = @{FirstName="%firstname%";LastName="%lastname%";initials="%initials%";} if ($Context.IsPropertyModified("samAccountName")) {

Get property value

  $newValue = $Context.GetModifiedPropertyValue("samAccountName")
  # Modify the value
  $newValue = $newValue + "2"
  # Update the value
  $Context.SetModifiedPropertyValue("samAccountName", $newValue)
  $context.SetModifiedPropertyValue("userPrincipalname", $newValue)

} So the user would be built but the UPN would not be set. Example image.png

0

So I set up a rule after creation to set the UPN if it is empty. image.png This will set the UPN but not @mydomain. image.png

1 Answer

0 votes
by (288k points)

Hello,

The behaviour you are facing is expected. The thing is your script sets the UON to a value that does not contain the domain part. For an example of the correct script, have a look at Example 2: Add a digit to the username if it is not unique of the following tutorial: https://www.adaxes.com/tutorials_SimplifyingDataEntry_ValidateModifyUserInputWithScript.htm#collapse3. Pay attention to the following lines that form and set the UPN:

# Update User Logon Name
$upnSuffix = $Context.GetObjectDomain("%distinguishedName%")
$userLogonName = $uniqueUsername + "@" + $upnSuffix
$Context.SetModifiedPropertyValue("userPrincipalName", $userLogonName)

Related questions

0 votes
0 answers

When the UPN being created is the same as an existing one except for the case. For instance, the new UPN is sally.fields but there's an existing Sally.Fields. The ... but then fails to create the AD account indicating that the UPN is not unique forestwide.

asked Jul 13, 2022 by sandramnc (870 points)
0 votes
1 answer

Thanks for the info. I'm now grabbing the %adm-ManagerUserName% value, but need to remove the final 21 characters of it so it contains only their username and not our ... this in the PowerShell Script Editor for my business rule, I get the following error:

asked Mar 11, 2021 by mkvidera (60 points)
0 votes
1 answer

The rule runs but since the first name and last name are passed as parameters, I only get the sequential # as a userID without the initials.

asked Oct 24 by curtisa (290 points)
0 votes
0 answers

We are looking for a tool that can support a blacklist for password resets and that will enforce this blacklist to certain OU groups but not others, or potentially use a whitelist of users that it will not be enforced upon.

asked Mar 2, 2020 by zachThankYou (20 points)
0 votes
1 answer

Using this built in function: There is no option to change the domain on the user account, however this is not the domain we use for UPN. However after creating a user, you can change it but trying to avoid going back into the object.

asked Apr 14, 2023 by mightycabal (1.0k points)
3,541 questions
3,232 answers
8,225 comments
547,802 users