How to add proxy addresses to Active Directory users using PowerShell

Last updated on:

The key to supporting multiple email aliases is managing proxy addresses. This ensures mail routing in hybrid environments, and facilitates smooth transitions during Exchange or Microsoft 365 migrations. PowerShell helps you add proxy addresses using the Set-ADUser cmdlet. However, the cmdlet has certain limitations that lead to repetitive effort and require advanced technical skills. This article explains three easy ways to add proxy addresses to users in AD.

What is a proxy address?

A proxy address (or email alias) is an alternative email address assigned to a user's mailbox in AD or Exchange. It allows the user to receive emails sent to multiple addresses within the same mailbox. Proxy addresses are essential for managing multiple domains, ensuring mail delivery, and maintaining compatibility in hybrid or migration setups.

In AD, these addresses are stored in the proxyAddresses attribute, a multi-valued property that can include different address types such as SMTP, X500, and SIP addresses. When objects are synced to Microsoft Entra ID, the values from the mail or proxyAddresses attributes are copied and used in a process called proxy calculation. This process determines the final set of proxy addresses in Entra ID based on various aspects of the on-premises directory data.

  • PowerShell
  • ADUC
  • ADManager Plus
  • Native tools limitations
  • Why ADManager Plus
  • FAQs
 

Adding proxy addresses using PowerShell

Prerequisites

  1. Open PowerShell as an administrator.
  2. Ensure the AD module is loaded. If not, import by running the script below:
    Import-Module ActiveDirectory
  3. Determine the identity of the AD user to whom you want to add the proxy address. This can be their sAMAccountName, UserPrincipalName, or DistinguishedName.

Using Set-ADUser to add proxy addresses

Use the Set-ADUser cmdlet with the -Add parameter to add a new proxy address to the proxyAddresses attribute. This ensures that existing proxy addresses are not overwritten.

This example below adds "john.doe.alias@example.com" as a secondary proxy address for the user "JohnDoe":

Set-ADUser -Identity "JohnDoe" -Add @{proxyAddresses="smtp:john.doe.alias@example.com"}

Examples and scripts to modify proxy addresses using PowerShell

Example 1: Add multiple proxy addresses in a single command

Appends two new SMTP proxy addresses for "jdoe" without affecting existing ones.

Set-ADUser -Identity "jdoe" -Add @{'proxyAddresses'=("smtp:jdoe.sales@corp.com","smtp:jdoe.support@corp.com")}

Example 2: Adding a proxy address for a group of users in an OU

Adds a unique sales alias for every user in the Sales OU based on their account name.

Get-ADUser -Filter * -SearchBase "OU=Sales,DC=domain,DC=com" | ForEach-Object {
Set-ADUser -Identity $_.SamAccountName -Add @{'proxyAddresses'="smtp:$($_.SamAccountName).sales@corp.com"}
}

Example 3: Adding proxy address for multiple users in bulk using a CSV file

Imports a CSV file "users.csv" with a list of users including sAMAccountName and ProxyAddressToAdd columns.

Import-Csv -Path "C:\path\to\users.csv" | ForEach-Object {
$userSAM = $_.sAMAccountName
$newProxy = $_.ProxyAddressToAdd
Set-ADUser -Identity $userSAM -Add @{proxyAddresses=$newProxy}
}

Example 4: Set primary SMTP address for a user

Sets a primary proxy address using the Set-Mailbox cmdlet.

Set-Mailbox -Identity "JohnDoe" -PrimarySmtpAddress "john.doe.new.primary@example.com"

Supported parameters

The following essential parameters can be used while modifying proxy addresses:

Parameters Description
-Identity Specifies the user account to modify.
-Add Hashtable of attributes (like proxyAddresses) to append.
-Replace Replaces existing proxyAddresses with the supplied array.
-Remove Removes proxy addresses from the user.
-Filter Query syntax to find users by conditions.
-SearchBase Limits scope to a specific OU/container.

How to add proxy addresses using ADUC

The Active Directory Users and Computers (ADUC) console provides a graphical interface to add a proxy address to a user:

  1. Open Active Directory Users and Computers.
  2. Locate and right-click on your preferred user, and choose Properties.
  3. Select the Attribute Editor tab.
  4. Scroll down and select the proxyAddresses attribute.
  5. Click Edit and add the new address. Use "SMTP:" before the address for the primary alias, or "smtp:" for all secondary aliases (e.g., SMTP:user@domain.com or smtp:alias@domain.com).
  6. Click OK to apply changes.
Adding proxy addresses to an AD user using ADUC

Adding proxy addresses using ADManager Plus

ADManager Plus is an all-in-one AD, Exchange, and Microsoft 365 management solution that lets you add proxy addresses to a single user or multiple users in bulk.

  1. Navigate to Management > User Management > Bulk User Modification > Exchange Tasks > Modify SMTP Address.
  2. Choose the user category as Mailbox Enabled Users or Mail Enabled Users.
  3. In the Proxy Address field, click + to add the SMTP address. Use "SMTP:" before the address for the primary alias, or "smtp:" for all secondary aliases (e.g., SMTP:user@domain.com or smtp:alias@domain.com).
  4. Under Show User List, select the domain and enter the names of the users for whom you'd like to add proxy addresses. To import a user list, select Import CSV.
  5. On the following screen, select the users and click Apply.
Adding proxy address for Active Directory user using ADManager Plus

Limitations of using native tools to modify proxy addresses

Although powerful, relying solely on PowerShell and ADUC can present challenges:

  • PowerShell commands can get complex with different use cases and scenarios.
  • Requires exact distinguished names and user identifiers, which can complicate bulk updates.
  • IT admins can spend a lot of time troubleshooting errors, which negatively impacts productivity.
  • Delegation can get tricky since technicians require elevated permissions.
  • ADUC limits operations to modify only one user at time.

How ADManager Plus helps you manage AD users

ADManager Plus is a web-based AD and Microsoft Entra ID management and reporting tool that simplifies AD user management and more from a centralized interface:

Simplify AD management and reporting with ADManager Plus

FAQ

SMTP (Simple Mail Transfer Protocol) defines how emails are sent between mail servers. Each user's mailbox in Exchange or AD uses an SMTP address, the unique identifier for sending and receiving emails. The primary SMTP address is the user's main email address, while additional proxy addresses (secondary SMTP addresses) let the user receive emails sent to other aliases within the same mailbox.

The primary SMTP address is the main email address associated with a user's mailbox in AD or Exchange. It is the address that appears in the “From” field when a user sends an email. While users can have multiple proxy addresses, the primary SMTP address uniquely identifies the mailbox and handles outbound mail communication.

The difference is case-sensitive. SMTP: (uppercase) denotes the primary email address, while smtp: (lowercase) denotes a secondary address. In systems like Microsoft Exchange, the primary address is the default reply address, and all secondary addresses are used for receiving email but will not be the default for replies.

The one-stop solution to Active Directory Management and Reporting
Email Download Link