HOW TO: Add Email Addresses To Public Folders

by Bharat Suneja

A previous post shows how to add an additional email address to a mailbox/recipient [read “HOW TO: Add additional email addresses to a recipient“]. How do we add email addresses to Public Folders?

It should be pretty simple – If Get-Mailbox shows the emailaddresses property for a mailbox, and Set-Mailbox allows you to use the -EmailAddresses switch to add email addresses, one can’t be blamed for believing it’ll work the same way for Public Folders.

Objects other than Public Folders need to be mailbox or mail-enabled to be Exchange recipients, Public Folders do not (Yes, they are mail-enabled by default). To modify mail-related attributes of Public Folders, you use the Set-MailPublicFolder command.

To add additional email address to a (mail-enabled) Public Folder:

$PF = Get-MailPublicFolder “Sales”
$PF.EmailAddresses += “[email protected]
$PF | Set-MailPublicFolder

The first line gets mail-related properties of Public Folder “Sales” in a variable called $PF. Next, we add the additional email address, without wiping out the existing ones. Finally, we commit the change using Set-MailPublicFolder.

If you simply use Set-MailPublicFolder “Sales” -EmailAddresses “[email protected], it will replace the existing values in the EmailAddresses property.

Another difference to note between how the Set-PublicFolder and Get-PublicFolder commands work, compared to Set-MailPublicFolder and Get-MailPublicFolder – the former takes a relative path of a Public Folder. For instance, to get the Sales PF if it’s in the root of the Public Folder tree, we would need to add a \ before the name:

Get-PublicFolder \Sales

However, the Get/Set-MailPublicFolder commands work using the alias/display name of the PF. Why the difference? One way to look at it – when using Get/Set-PublicFolder, you’re working with the actual Public Folder. When using Get/Set-MailPublicFolder, you’re working with the Active Directory object created for that Public Folder (which holds mail-related attributes, making it possible for a Public Folder to be mail-enabled).

To change the primary email address of the Public Folder “Sales” from “[email protected]” to the new address we just entered – “[email protected]”:

Set-MailPublicFolder “Sales” -EmailAddressPolicyEnabled $false -PrimarySmtpAddress “[email protected]

As you may have already figured out, we exempted the Public Folder from getting EmailAddressPolicies applied. In Exchange Server 2003/2000, you could change the default email address of a recipient, without unchecking the checkbox. Result: A few minutes after you completed the change, Recipient Policies would apply and change the primary email address back.

Exchange Server 2007 doesn’t let you change the default email address without exempting the recipient from email address policies.

{ 5 comments… read them below or add one }

Gwido November 15, 2007 at 7:22 pm

This is the best way I have found thus far pre SP1 to add aliases to your public folders


mipbar April 30, 2008 at 1:34 pm

Anyone know why
$PF.EmailAddresses += $arrProxySMTPs[$i]


Exception setting “EmailAddresses”: “Cannot convert value “System.Object[]” to type “Microsoft.Exchange.Data.ProxyAddressCollection”


Elkagorasa December 15, 2008 at 2:40 pm

Hey Thanks for the code idea. I am working on a script to add secondary addresses to a DL.
$SMTP = [Array of Addresses.]
foreach ($Address in $SMTP) {
$Addr = $Address.Replace(“SMTP:”,””)
if (($Alias.emailaddresses -match $Addr) -eq $FALSE){
$alias.emailaddresses += $Addr
$Alias | Set-DistributionGroup


cazadores February 5, 2018 at 9:01 am


I’m currently migrating from Exchange 2010 (sp3 ru16) to 365, and we have 748 public folders that have old email addresses, domains from many years ago that are either invalid “.local” or no longer owned by us, and we need to remove these email addresses from all public folders. I’ve seen a few scripts that have potential, but none that address the issue of removing all vs. one at time which is not an option given the number of PF’s we have. Any help would appreciated.


Bharat Suneja February 13, 2018 at 9:43 am

Cleaning up zombie email addresses can be a fun scripting project. Not sure if I’ve blogged here or posted a script. Little r me at bsuneja at if you need help.


Leave a Comment

Previous post:

Next post: