0 votes

I need set, or verify, that all of my users have the same primary email alias suffix. Several years ago, we rebranded to a new internet presence. All users yhave both aliases (old and new suffix). However we have a mix of some users with the old as primary, and some users with the new as primary SMTP. I want to:

  • Set all users that are still using the old alias to use the new as primary, while retaining the old as an alternate alias.
  • Skip changes on users that are already using the new alias, but confirm that they have the old as alternate.

I have over 500 users, Microsoft's answer is to manually edit the user attributes in AD, one by one. Not really a very great answer. Looking for automation, and we are an Adaxes supported shop.

by (20 points)

1 Answer

0 votes
by (294k points)

Hello Ian,

As we understand, the operation needs to be performed just once. As such, you can use the following script from our repository: https://www.adaxes.com/script-repository/update-suffix-of-the-primary-smtp-address-s610.htm. To execute the custom command with the script for multiple users in bulk, you can get the list of users using a report. For example, you can use the built-in All users report. By default, the report is located in container Reports\All Reports\Users.

0

Thanks, I'll take a look today. My challenge is that as I said, this is NOT a new SMTP address, my users already have the correct address. The need here is to set the right one as primary in Exchange O365. Not adding or removing any addresses, just setting the correct one as primary. This script looks to be all about creating new SMTP addresses, which is NOT what I need, but I'll have a look and see if I can adapt it to my actual need.

0

Hello Ian,

Sorry for the confusion, but we are not sure what exactly you mean. Is it that all users already have email addresses with both suffixes set and the script should just make sure that the one with the new suffix is set as primary? If that is correct and you have issues updating the script from our repository to meet your needs, please, do not hesitate to get back to us.

0

Apologies in advance - I am NOT a script guy! Scenario is:

  • Two different email suffixes are already deployed to 500+ users on O365
  • Users are currently set some to use old suffix as their primary, some (most) as new suffix is primary.
  • MS support says the only way to set, or confirm the setting of, all users to the new suffix as primary while maintaining the old suffix as alternate smtp is to manually edit the 500+ users one by one
  • Desperately hoping there is another way -desired outcome is to have all users with both suffixes configured and usable, but also all users set to new suffix as their primary. This is in anticipation of eventually (90 days) eliminating the old suffix and email support completely, with a smooth transition.

I am trying to get my head wrapped into the script you linked, for a non script experienced guy, it's like listening to Charlie Brown's teacher :)

0

Hello Ian,

Thank you for the provided details. For us to provide you with the script, please, specify what should be done if a user has no email address with either of the suffixes. Any additional details and live examples will be much appreciated.

0

That exception would not occur. All users have both email aliases. My first task here is to set all users to use the newer one as their primary.

0

Hello Ian,

Thank you for the clarification. Please, use the below script. To execute the script, create a custom command configured for the User object type. In the script, the $suffixToSearch variable specifies the suffix email addresses ending with should be set as primary.

$suffixToSearch = "domain.com" # TODO: modify me

# Get primary SMTP Address
$mailboxParams = $Context.TargetObject.GetMailParameters()
$emailAddresses = $mailboxParams.EmailAddresses

$smtpEmailAddresses = $emailAddresses.GetAddressesByPrefix("smtp")
$addressString = $NULL
foreach ($emailAddress in $smtpEmailAddresses)
{
    $addressSuffix = $emailAddress.Address.Substring($emailAddress.Address.IndexOf("@") + 1)
    if ($addressSuffix -ne $suffixToSearch)
    {
        continue
    }

    if ($emailAddress.IsPrimary)
    {
        return
    }

    $addressString = $emailAddress.Address
    break
}

if ($NULL -eq $addressString)
{
    return # Address not found
}

# Create an instance of the 'AdmExchangeMailboxParameters' class
$mailboxParams = New-Object "Softerra.Adaxes.Adsi.Exchange.AdmExchangeMailboxParameters"

# Disable automatic update of e-mail addresses based on e-mail address policy
$mailboxParams.EmailAddressPolicyEnabled = $False

$emailAddresses = $mailboxParams.EmailAddresses
$emailAddresses.OverrideOldValues = $False

# Create a new email address
$emailAddress = $emailAddresses.CreateAddress("ADM_EXCHANGE_ADDRTYPE_SMTP", $null)
$emailAddress.Address = $addressString
$emailAddress.IsPrimary = $True

# Add the new email address to the existing list
$emailAddresses.Add("ADS_PROPERTY_APPEND", $emailAddress)
$mailboxParams.EmailAddresses = $emailAddresses

# Save the changes
$Context.TargetObject.SetMailParameters($mailboxParams, "ADM_SET_EXCHANGE_PARAMS_FLAGS_NONE")

Related questions

0 votes
1 answer

Hi, I try to make a report for our SAM to show all users with a specific license. But I fail to even find anything. I tried, among many ... .DirectorySearcher.AppendFilter("(adm-O365AccountLicenses=POWER_BI_STANDARD)") But I get nothing. Please advice.

asked May 20, 2021 by KristofferJ (80 points)
0 votes
1 answer

The script create two reports of inactive workstation operating systems. The report is too detailed to run from one of the adaxes reports. Basically how can I set the script up to ... sure How I did this but I can't find it now (probably something simple).

asked Nov 30, 2022 by mightycabal (1.0k points)
0 votes
1 answer

Hello, I'm wondering if it's possible to export a list of all users in AD along with their email addresses to an Excel spreadsheet and then schedule that export to append ... address that wasn't previously used. Please let me know if this is possible. Thanks!

asked Apr 11 by sjjb2024 (60 points)
0 votes
1 answer

We have a 3rd party vendor that we are able to add users based on AD security groups. What I need to do is set a parameter for the number of available licenses and whenever ... the group is 495 I would like an email to trigger telling me to add more licenses.

asked Oct 12, 2022 by A_Pastor (70 points)
0 votes
1 answer

In the user creation entry I have added a renamed custom attribute called Start Date so that the requester can only request accounts be created past a certain relative ... a limitation of the product or am I looking to implement this requirement incorrectly?

asked May 28, 2021 by manomano (80 points)
3,588 questions
3,277 answers
8,303 comments
548,085 users