Laeeq Qazi's Exchange Server Blog

Exchange Server blog

How to recreate Primary Hierarchy Public Folder Mailbox in Exchange 2013

Hi,

Sometimes, in our lab, developers delete Primary Public Folder Hierarchy Mailbox by mistake, and after it, we cannot perform any public folder operation via PF cmdlets.

E.g. a get-publicFolder cmd thows this error:

[PS] C:\Windows\system32>Get-PublicFolder \ -GetChildren
Couldn't find the public folder mailbox.
+ CategoryInfo : NotSpecified: (:) [Get-PublicFolder], ObjectNotFoundException 

Confirmation:

This is how I first confirm that ‘Primary Hierarchy Public Folder Mailbox’ has been deleted:

First I get the Primary Hierarchy PF mailbox using this command

Get-OrganizationConfig | FL RootPublicFolderMailbox

RootPublicFolderMailbox represents GUID of PF mailbox.

When I retrieved all PF Mailboxes, Guid of RootPublicFolderMailbox was not there:

Get-Mailbox –PublicFolder | FL Name,ExchangeGuid

which confirms that ‘Primary Hierarchy Public Folder Mailbox’ is no more in Exchange Server 2013, and someone has deleted it.

Recreation of Public Folder Hierarchy Mailbox:

The only way to recreate ‘Primary Hierarchy PF Mailbox’ I discovered via this helpful blog http://careexchange.in/how-to-recreate-public-folder-master-hierarchy-in-exchange-2013.
which is to remove all Public folders, all Secondary Public Folder Mailboxes, but I was not able to remove Public Folders and getting this error.

[PS] C:\Windows\system32> Get-PublicFolder -Recurse | Remove-PublicFolder
Couldn't find the public folder mailbox.
+ CategoryInfo : NotSpecified: (:) [Get-PublicFolder], ObjectNotFoundException

So in the end, what I did was ‘Remove AD users associated with all Secondary PF Mailboxes using ‘Active Directory Users and Computers’ console.

For this, first I got the location of all secondary PF Mailboxes like this:

Get-Mailbox –PublicFolder | FL DistinguishedName

And then Removed the associated AD user using ADUC console, which subsequently disconnected all PF mailboxes.

Then I opened ADSIEdit.msc , and went to “Cn=Configuration” container, and browsed ‘Exchange Organization’ object’s properties, whose AD Path looks like this:

CN=OrganizationName,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=AdDomain,DC=lab

From properties of this object, I just cleared the value from the attribute ‘msExchDefaultPublicFolderMailbox’, which you can see is just a garbage.

Then I just re-created the Primary Hierarchy PF mailbox using this command:

New-Mailbox -PublicFolder -Name 'Primary Hierarchy PF Mailbox'

Then I recreated my secondary PF Mailboxes, and then created Public Folders.

Note: Please test this in a lab, before applying to production scenarios. Also, This doesnt recover existing Public folders.

Advertisements

December 26, 2013 Posted by | Exchange 2013 | , | 8 Comments