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.

[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.

[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.

[PS] C:\>Get-Recipient ‘Peter Grover’ | fl Office,Emailaddresses

Office         : Sydney
EmailAddresses : {smtp:Peter.Grover@company.com, SMTP:Peter.Grover@sydney.company.com}

exchange-2007-logo.jpgOne of the enhancements to Exchange Server 2007 with Service Pack 1 is the ability to view public folders when logged in to Outlook Web Access.

publicfolder000.png

When an Exchange Server 2007 mailbox user attempts to open a public folder they may see the following information in the OWA window.

publicfolder001.png

This will appear if the public folder database configured for use by mailboxes on the Exchange Server 2007 mailbox database does not contain any content. If the user clicks the “click here” link they are taken to the Exchange Server 2003 web-view of the public folder.

When Outlook Web Access accesses public folders from an Exchange 2007 SP1 mailbox, Outlook Web Access first tries to connect to an Exchange 2007 SP1 public folder store. If no Exchange 2007 SP1 public folder database is available, the Outlook Web Access server next tries to connect to an Exchange 2003 public folder store. When it connects, the user will see the public folder by using the Outlook Web Access 2003 UI.

Source (Microsoft Technet)

This behaviour will occur if the public folder store on the Exchange Server 2007 server has not been configured as a replica for that public folder. Although a public folder store on an Exchange Server 2007 server will hold the public folder hierarchy information, it will only perform public folder referrals to another server if it does not hold a local replica of the data. If that public folder referral results in the user being directed to an Exchange Server 2003 server, they will receive the prompt shown above.

To resolve this issue configure your Exchange Server 2007 public folder store to be a replica for the public folder content. You can view the current list of replicas for a public folder with the Get-PublicFolder cmdlet.

[PS] C:\>Get-Publicfolder “\NameOfFolder” | fl name,replicas

Name     : NameOfFolder
Replicas : {Public Folders}

To see all public folders you can do a recursive search.

[PS] C:\>Get-Publicfolder \ -Recurse | fl name,replicas

Name     : IPM_SUBTREE
Replicas : {}

Name     : NameOfFolder
Replicas : {Public Folders}

Name     : NameOfNextFolder
Replicas : {Public Folders}

Public folder replicas can be managed with the Set-Publicfolder cmdlet. The “replicas” attribute is multi-valued, and the Set-Publicfolder cmdlet will set it but not append to it, so you must include any existing replicas that you want to retain in the list.

[PS] C:\>Get-PublicFolder -recurse | Set-PublicFolder -Replicas “SERVER1\Public
 Folders”,”SERVER2\Public Folders”,”SERVER3\Public Folders”

The public folder content will replicate to the new replicas using the configured public folder replication interval. If you wish to do an update manually to speed things up you can use the Update-Publicfolder cmdlet.

Once the public folder store is listed as a replica and the content has replicated the Exchange Server 2007 SP1 mailbox users will be able to access the content in Outlook Web Access.

See also How to configure public folder replication.

exchange-2007-shell-logo.jpgWhen deploying customer systems I almost never use the default “First Storage Group” and the associated mailbox database, or at the very least will move and rename them to suit the situation. In a lot of cases more than one storage group and mailbox database is required for the customer. Creating these through the Exchange Management Console is a bit of a drag, and so is doing them one by one in the Exchange Management Shell.

Since you’ve pre-planned your Exchange system before installing it (right?) you can also take the time to whip up a script that will create your storage groups and mailbox databases for you while you do something more enjoyable. The script will make use of the New-StorageGroup, New-MailboxDatabase, and optionally the Mount-Database cmdlets.

I’ve uploaded a sample script here:
PowerShell Script

How to run the script:

  1. Download the script file from the link above and save it to your computer
  2. Rename the file extension to .ps1
  3. Launch the Exchange Management Shell
  4. Execute the script by entering the name of the file (eg C:\Script\createmailstores.ps1)

The script will output the name of each Storage Group as it is created, and then the name and all of the details of each of the Mailbox Databases as they are created. A 300 second (5 minute) sleep is inserted at the end to try to avoid errors that can appear if you try to mount a database too soon after it has been created.

If any of the databases fail to mount you can wait a few more minutes before trying again. One way of mounting several dismounted databases all together is to pipe the Get-MailboxDatabase cmdlet into the Mount-Database cmdlet like so:

Get-MailboxDatabase | Mount-Database

Because all of the databases are created with the MountAtStartup attribute set to True you can also mount all of the databases by restarting the Microsoft Exchange Information Store service like so:

[PS] C:\>Restart-Service MSExchangeIS
WARNING: Waiting for service ‘Microsoft Exchange Information Store
(MSExchangeIS)’ to finish stopping…
WARNING: Waiting for service ‘Microsoft Exchange Information Store
(MSExchangeIS)’ to finish starting…

You should not use the Restart-Service method if you already have production databases running on the server.

exchange-2007-shell-logo.jpgThanks to the Exchange Management Shell you can check the status of your Exchange Server 2007 services with a single command line.

[PS] C:\>Get-Service | Where {$_.Name -match “Exchange”} 

Status   DisplayName
——   ———–
Running  Microsoft Exchange Active Directory…
Running  Microsoft Exchange Anti-spam Update
Running  Microsoft Exchange EdgeSync
Running  Microsoft Exchange File Distribution
Stopped  Microsoft Exchange IMAP4
Running  Microsoft Exchange Information Store
Running  Microsoft Exchange Mailbox Assistants
Running  Microsoft Exchange Mail Submission
Stopped  Microsoft Exchange Monitoring
Stopped  Microsoft Exchange POP3
Running  Microsoft Exchange Replication Service
Running  Microsoft Exchange System Attendant
Running  Microsoft Exchange Search Indexer
Running  Microsoft Exchange Service Host
Running  Microsoft Exchange Transport
Running  Microsoft Exchange Transport Log Se…
Running  Microsoft Search (Exchange)

exchange-2007-shell-logo.jpgExchange Server 2007 permits you to install the product and use it for 120 days in trial mode without entering a product key. If you intend to use your system in production you should enter your Exchange Server 2007 product key within that 120 day period (preferably before your system goes into production).

You can check the status of your servers using the Exchange Management Console.

[PS] C:\>Get-ExchangeServer | fl name,productkey,*trial* 

Name                              : MAILSRV
IsExchange2007TrialEdition        : False
IsExpiredExchange2007TrialEdition : False
RemainingTrialPeriod              : 00:00:00 

Name                              : MAILSRV1
IsExchange2007TrialEdition        : True
IsExpiredExchange2007TrialEdition : False
RemainingTrialPeriod              : 119.06:14:51.6643750

To add your product key to a server use the Set-ExchangeServer cmdlet.

[PS] C:\>Set-ExchangeServer -Identity MAILSRV1
-ProductKey 12345-ABCDE-12345-ABCDE-12345 

WARNING: The product key has been validated and the
product ID has been successfully created.
Note: This change will not be complete until the
Microsoft Exchange Information Store service has
been restarted. 

[PS] C:\>restart-service MSExchangeIS
WARNING: Waiting for service ‘Microsoft Exchange
Information Store (MSExchangeIS)’ to finish
stopping…

You can now use Get-ExchangeServer to verify the server is correctly licensed.

[PS] C:\>Get-ExchangeServer | fl name,productkey,*trial* 

Name                              : MAILSRV
IsExchange2007TrialEdition        : False
IsExpiredExchange2007TrialEdition : False
RemainingTrialPeriod              : 00:00:00 

Name                              : MAILSRV1
IsExchange2007TrialEdition        : False
IsExpiredExchange2007TrialEdition : False
RemainingTrialPeriod              : 00:00:00