This content comes from a chapter removed from my book Microsoft Exchange Server 2010 Inside Out, also available at Amazon.co.uk
(including a Kindle edition
). The first part of the chapter is available in this post. Now let’s get on with some more discussion about public folders.
Creating new replicas
The default state for a public folder is that a single replica exists in the database where an administrator originally creates the folder unless replicas exist for the parent folder, in which case Exchange creates replicas for the new child folder in the databases where replicas exist for the parent.
Having a single replica of a folder may be the most appropriate state for the folder if all users are able to make reliable connections to the server that hosts the database. However, in large or distributed environments it is common to create several replicas so that users can always make a local connection. We will discuss how to control the process by which Exchange decides to which replica a client should connect in the “Removing public folders” section. For now, let’s review how to create the replica folders.
Open the public folder management console and locate the folder that you want to replicate. Click Properties and then select the “Replication” tab (Figure 1). You will see the list of databases that currently have replicas and will be able to add new databases. The equivalent EMS command is:
Set-PublicFolder -Identity '\Departments\Finance' -Replicas 'PFDatabase1','PFDatabase2'
Replication is performed through special messages sent between the servers (using SMTP) that host the public folder databases that include the replicas. Each database has a replication schedule that typically replicates new items or other content updates for public folders every 15 minutes. Content is broken up into relatively small (by today’s standards) 300KB messages to ensure fast and efficient distribution. You can force immediate replication by selecting the Update Content option from the action pane. This might be required if a user wanted the immediate distribution of some important information throughout the organization. If you don’t already have the public folder management console fired up and ready to go, it’s probably quicker to invoke the Update-PublicFolder cmdlet from EMS. In this instance, we force replication of the contents of the Press Releases folder using the folder from the database on server ExServer1:
Update-PublicFolder –Identity '\Departments\Marketing\Press Releases' –Server ExServer1
By comparison to folder content, changes to the folder hierarchy are replicated as soon as they occur, so the addition or deletion of a folder should replicate throughout the organization very quickly.
Mail-enabling a public folder
A mail-enabled public folder is able to accept new items via email. If anonymous access is permitted, anyone will be able to create a message, address it to the folder, and send it to Exchange for delivery. A public folder is mail-enabled with the Enable-MailPublicFolder cmdlet. Alternatively, you can select the folder from the Public Folder console and click on the “Mail Enable” option in the action pane. Mail-enabled public folders are listed in the console with a different icon from folders that are not mail-enabled. In this extract from EMC (Figure 2), four mail-enabled public folders are listed.
When you mail-enable a public folder, Exchange also reveals it to users in the GAL, albeit with minimal useful detail (Figure 3). It might not be desirable to have public folders shown in the GAL; you might prefer to have users post to the folder by addressing messages to the folder’s SMTP address. These commands mail-enable a public folder and hide it from the GAL:
Enable-MailPublicFolder –Identity '\Departments\Finance\Forms'
Set-PublicFolder –Identity '\Departments\Finance\Forms'
–HiddenFromAddressListEnabled $True
You can also hide a public folder from Exchange address lists by selecting it in the Public Folder management console, view its properties, navigate to the Exchange General property page, and select the checkbox to hide the folder. Hiding mail-enabled public folders only conceals them from users. Even if you hide a mail-enabled public folder from the Exchange address lists, administrators will continue to see these objects listed in the picker dialogs used to select recipients for various tasks such as adding recipients to distribution groups.
Behind the scenes, when you mail-enable a public folder, Exchange creates a new object for the folder in the Microsoft Exchange System Objects OU. Figure 4 shows the attributes of a mail-enabled public folder as viewed through the ADSIEdit utility. The new object is used to hold properties of the public folder such as the proxy email addresses, mail tips, and so on. The properties of the new object can then be viewed with the Get-MailPublicFolder cmdlet and manipulated with the Set-MailPublicFolder cmdlet.
The mail-related properties that are available to mailboxes, groups, and contacts are also available for public folders. For example, here’s how to set up moderation for a public folder so that only users from a specific group plus the moderator can post items. Any other attempt has to go through moderation.
Set-MailPublicFolder –Identity '\Departments\Finance' –ModeratedBy 'Redmond, Tony' –MailTip 'Only members of the Finance Department can post to this folder'
–ByPassModerationFromSendersOrMembers 'FinanceUsers' , 'Redmond, Tony'
–ModerationEnabled $True
You can disable a mail-enabled public folder with the Disable-MailPublicFolder cmdlet. This will also remove the Active Directory object and the GAL.
Disable-MailPublicFolder –Identity '\Departments\Finance\Forms'-Confirm:$False
Bad email addresses for email-enabled public folders
No system folder needs to be mail-enabled. However, you may see errors flagged when you apply an email policy to these objects. The likely cause is that these folders were enabled for email in a previous version of Exchange and their names or aliases include spaces or special characters that cannot be used in SMTP addresses, and so are found to be invalid when Exchange attempts to use them to create email addresses according to the email policy. If you see an error like this, you can disable email for the folders and remove their email addresses with this code:
Get-PublicFolder '\non_ipm_subtree' –Recurse –ResultSize Unlimited | Disable-MailPublicFolder –ErroractionSilentlyContinue
Afterwards, you can fix the names of the folders to remove any offending characters from their names or aliases and then re-enable them for mail.
Removing public folders
The Remove-PublicFolder cmdlet deletes a public folder from the public folder hierarchy and removes all content and replicas that exist in public folder databases in the organization. The simplest deletion is to remove just one folder. For example:
Remove-PublicFolder –Identity '\Departments\Finance\Tools' –Confirm:$False
This command works if the folder has no children. If a child folder exists you’ll be told that you can’t delete a parent folder until you first remove any child folders. You can do this with much the same command by adding the –Recurse parameter to force Exchange to locate and remove any child folders before it removes the parent.
Remove-PublicFolder –Identity '\Departments\Finance\Tools' –Recurse –Confirm:$False
In these examples I’ve suppressed the confirmation prompt because I am pretty confident about the folder that I want to delete. A delete of a public folder cannot be reversed as there’s no equivalent of a deleted items folder for public folders or the items that they contain – unless you use the ExFolders utility to recover the deleted folder. Even then, ExFolders might not be able to recover a deleted public folder, so it’s a good idea to be sure that you really want to remove a folder before you proceed to do it.
It’s a good idea to clean up old and obsolete public folders on a regular basis. You can scan for folders that don’t hold a lot of content or haven’t been accessed recently. This command fetches the set of folders in the hierarchy as known in the public folder database on a server and generates statistics for each folder before sorting the set by the last modification time before outputting details into a report.
Get-PublicFolder –Identity '\' -Server ExServer1 -Recurse
-ResultSize Unlimited | Get-PublicFolderStatistics | Select Name, ItemCount, TotalItemSize, LastModificationTime| Sort-Object LastModificationTime
–Descending | Format-Table –AutoSize> C:\Temp\PFReport.txt
Controlling public folder referrals
Any public folder can be replicated to databases on multiple servers. The public folder hierarchy is always replicated to every public folder database so that each server can present a complete view of every public folder that is available in the organization to clients that request this data. The folder hierarchy lists every folder, its permissions, and details of the servers that currently host databases that contain replicas of each folder. Replicas of every folder do not necessarily exist in every public folder database. When public folders exist in an organization, every mailbox database is associated with a public folder database and clients always attempt to connect to folder replicas in the public folder database associated with their mailbox database. If clients need access to a folder replica that is not present in the database that they are currently connected to, Exchange creates a referral to the most appropriate public folder database that contains a replica. You can view the public folder database that is used by a mailbox database by looking at its properties through the Client Settings tab. As you can see in Figure 5, the IT Department database currently uses PFDatabase1, so any connections from mailboxes hosted by this database will go to PFDatabase1. If this isn’t the most appropriate public folder database to use, we can select another one – perhaps a public folder database that is hosted by the same server as the mailbox database.
When a mailbox database is created, Exchange checks the available public folder databases to decide which to associate with the new mailbox database. If a public folder database is available on the same server, it is selected. If not, the first public folder (listed alphabetically) in the organization is used. Over time, this leads to a certain imbalance in the workload going to the first public folder database. To check the current allocation of mailbox databases to the available public folder databases:
Get-MailboxDatabase | Select Name, PublicFolderDatabase
You can then move work by updating a mailbox database as follows:
Set-MailboxDatabase -Identity 'IT Department'-PublicFolderDatabase 'PFDatabase2'
The default mechanism used to determine the best referral is based on Active Directory site link costs. First, Exchange looks for servers in the local site to see if there are public folder databases available that contain the required folder. If no local servers are available, Exchange builds a list of available servers that host public folder databases in other sites and orders them by cost. Exchange then attempts to contact each server to see whether they have an available replica and will connect to the first replica folder that it finds.
It is possible to ignore the Active Directory site link costs and use a custom referral list instead. To do this, go to the Organization Configuration node of EMC and then Mailbox, and then select the public folder database with which you want to work. Now click Properties To and then select the Public Folder Referral tab. As expected, the default option is to use Active Directory site costs. However, as shown in Figure 6, you can create a custom list of mailbox servers (that host public folder databases) and assign each a cost from 1 to 100 to have Exchange use this list when it determines client referrals. Costs are prioritized from lower to higher, so you should assign a cost of 1 (one) to the server that you want to direct client referrals to whenever possible and any other value up to 100 for the other servers. The higher the cost value, the less likely Exchange will use it for client referrals.
You can create a custom referral list with EMS too. In the example shown below, we select create a list of three mailbox servers that host public folder databases and assign each server with a different cost to provide Exchange with an order to use to check the servers for public folder replicas. Finally, we tell Exchange to use the custom server list rather than using the default Active Directory site cost.
Set-PublicFolderDatabase -Identity 'ExServer1\PubFolders1'
-CustomReferralServerList 'ExServer2:1','ExServer3:10','ExServer5:25'
-UseCustomReferralServerList $True













