• Home
  • About
  • Blog
  • Training
  • Books
  • Contact
    • Email
    • Facebook
    • Twitter
    • RSS

Practical 365

  • Office 365
  • Exchange 2019
  • Exchange 2016
  • Exchange 2013
  • Hybrid
  • Certificates
  • PowerShell
  • Migration
You are here: Home / Blog / EMS – Creating Email Address Policies for branch offices

EMS – Creating Email Address Policies for branch offices

April 24, 2008 by Paul Cunningham 3 Comments

exchange-2007-shell-logo In some companies different departments or branch offices require different primary SMTP addresses.  You can configure these for users with Email Address Policies.  In this example the company wants all users to have an @company.com address, but each branch office's users have a primary email address representing that branch.

First we must make sure each of the domains is included as an Accepted Domain, using the New-AcceptedDomain cmdlet.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
[PS] C:\>New-AcceptedDomain -Name 'Sydney' -DomainName 'sydney.company.com'
 
Name                           DomainName                     DomainTy Default
                                                              pe
----                           ----------                     -------- -------
Sydney                         sydney.company.com             Autho... False
 
 
[PS] C:\>New-AcceptedDomain -Name 'Brisbane' -DomainName 'brisbane.company.com'
-DomainType Authoritative
 
Name                           DomainName                     DomainTy Default
                                                              pe
----                           ----------                     -------- -------
Brisbane                       brisbane.company.com           Autho... False
 
 
[PS] C:\>New-AcceptedDomain -Name 'Melbourne' -DomainName 'melbourne.company.com
' -DomainType Authoritative
 
Name                           DomainName                     DomainTy Default
                                                              pe
----                           ----------                     -------- -------
Melbourne                      melbourne.company.com          Autho... False
 
 
[PS] C:\>New-AcceptedDomain 'Company.com' -DomainName 'company.com' -DomainType
Authoritative
 
Name                           DomainName                     DomainTy Default
                                                              pe
----                           ----------                     -------- -------
Company.com                    company.com                    Autho... False

Then we can configure the Email Address Policies using the New-EmailAddressPolicy cmdlet.  In this example I am using the “Office” user attribute to filter recipients.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[PS] C:\>New-EmailAddressPolicy -Name 'Sydney' -RecipientFilter {(Office -eq 'Sy
dney')} -EnabledEmailAddressTemplates 'SMTP:%g.%s@sydney.company.com','smtp:%g.%
s@company.com'
 
Name                       Priority                   RecipientFilter
----                       --------                   ---------------
Sydney                     1                          Office -eq 'Sydney'
 
 
[PS] C:\>New-EmailAddressPolicy -Name 'Brisbane' -RecipientFilter {(Office -eq '
Brisbane')} -EnabledEmailAddressTemplates 'SMTP:%g.%s@brisbane.company.com','smt
p:%g.%s@company.com'
 
Name                       Priority                   RecipientFilter
----                       --------                   ---------------
Brisbane                   2                          Office -eq 'Brisbane'
 
 
[PS] C:\>New-EmailAddressPolicy -Name 'Melbourne' -RecipientFilter {(Office -eq
'Melbourne')} -EnabledEmailAddressTemplates 'SMTP:%g.%s@melbourne.company.com','
smtp:%g.%s@company.com'
 
Name                       Priority                   RecipientFilter
----                       --------                   ---------------
Melbourne                  3                          Office -eq 'Melbourne'

Here is the result for a recipient who matches the filter for the Sydney policy.

1
2
3
4
5
[PS] C:\>Get-Recipient 'Peter Grover' | fl Office,Emailaddresses
 
 
Office         : Sydney
EmailAddresses : {smtp:Peter.Grover@company.com, SMTP:Peter.Grover@<br />sydney.company.com}

Paul Cunningham

Paul is a Microsoft MVP for Office Apps and Services and a Pluralsight author. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server.

0 Shares

Blog EMS, Exchange 2007, PowerShell

Comments

  1. Peter Nørredal says

    March 18, 2014 at 2:40 am

    Hi Paul
    I´m trying to create an email addresse policy from powershell, for users located on a different domain (Trust between AD forests) – from my mailbox server, located on my Hosting.local domain.

    I´m connected to the other forest, from this command:
    Get-ADOrganizationalUnit -Identity “OU=$CustomerName,OU=customers,DC=Domain,DC=local” –Server ‘DC01.domain.local’| FL

    (with Customername = Test.dk)
    No issues here 🙂

    BUT, when I try to create a new email address policy, pointing to the OU where the users are located on the domain: “Domain.local”, I get this error:

    ObjectNotFound: (OU=test.dk,OU=Customers,DC=Domain,DC=local:ADOrganizationalUnit) [Get-ADOrganizationalUnit], ADIdentityNotFoundException

    (BUT, the OU is there !!)

    I´m running this command from powershell:

    $CustomerName = Read-Host “New E-mail Domain for new customer”

    Import-Module activedirectory
    Get-PSDrive –Name Domain –PSProvider ActiveDirectory –Server ‘DC01.domain.local’ –credential (Get-Credential ‘domainadministrator’) –root ‘//RootDSE/’

    New-EmailAddressPolicy -Name $CustomerName -RecipientContainer “domain.local/customers/$CustomerName” -IncludedRecipients ‘AllRecipients’ -ConditionalCustomAttribute1 $CustomerName -Priority ‘1’ -EnabledEmailAddressTemplates SMTP:%2g%1s@$AcceptedEmailDomain

    Hope you can help me
    Best regards
    Peter

    Reply
    • Paul Cunningham says

      March 18, 2014 at 11:52 am

      I’ve never tried that scenario. Perhaps it is just a limitation that -RecipientContainer only works intra-forest.

      Reply
  2. Peter Nørredal says

    March 18, 2014 at 3:11 pm

    Hi Paul
    Thanks for your reply

    hmm, sounds odd if this senario doesn´t Work.(I surely hope it does, somehow)

    Because next step for me in this is creating Linked mailboxes” which also should rely on OU´s in a different domain+forest, – or in general People that are not located Intra-forest … Or am I missing something here ??

    Do you know about a forum/good website where I might get help /confimation regarding the above ?

    Thanks

    Reply

Leave a Reply Cancel reply

You have to agree to the comment policy.

Recent Articles

  • How attackers bypass third-party mail filtering to Office 365
  • SharePoint 365 and Azure integration – Using Azure Monitor to retrieve and analyze telemetry
  • Create custom reports using the updated Teams PowerShell module
  • Privileged Access Management – Part Two
  • Should you upgrade to Exchange Server 2019?
Practical 365

Popular Articles

Managing Change in Office 365Managing Change in Office 365

Training Courses

  • Configuring and Managing Office 365 Security
  • Office 365 Admin Playbook
  • Exchange 2016 Exam 70-345
  • Managing Exchange Mailboxes and Distribution Groups in PowerShell
  • More Training Courses...

Recommended Resources

  • Office 365 Security Resources
  • Office 365 Books
  • Exchange Server Books
  • Exchange Server Migrations
  • Exchange Analyzer
  • Digicert SSL Certificates

About This Site

Practical 365 is a leading site for Office 365 and Exchange Server news, tips and tutorials. Read more...
  • Email
  • Facebook
  • Twitter
  • RSS

Copyright © 2018 Quadrotech Solutions AG · Disclosure · Privacy Policy
Alpenstrasse 15, 6304 Zug, Switzerland

We are an Authorized DigiCert™ SSL Partner.