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 (203k 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 by KristofferJ (20 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 by manomano (20 points)
0 votes
1 answer

Hi, Hope you're doing well. I played a little bit with the new office 365 feature and I 've a quick question. I create user in AD through Adaxes and I wait the ... after/during activation ? Without using a PS script I mean :) Thanks in advance best regards

asked Jun 6, 2014 by smasset (730 points)
0 votes
1 answer

I have an ADP Sync scheduled task that modifies and creates users from a csv file. I also have reports that show new users created and management history for user ... ADP Sync scheduled task so that they only run after the ADP Sync task is complete?

asked Jan 7, 2020 by barberk (60 points)
0 votes
1 answer

I need a list of all the URLs that Adaxes creates in IIS on the server Adaxes is installed on.

asked Feb 6, 2020 by DaralenManta (20 points)
2,518 questions
2,263 answers
6,059 comments
487,188 users