Exchange Server 2007 Public Folder tasks introduction (part 1)

Exchange 2007 provides a rich set of PowerShell tasks for administering Exchange objects and Public Folders are no exception. The tasks let you perform basic public folder operations – i.e. Create a Public Folder, Modify a Public Folder, Delete a Public Folder – however, the real power comes from piping support and enabling bulk operations on these objects. Let's take a look at the tasks that exist to work with public folders.

Public Folder Management Tasks for individual public folders

These tasks are used to manage public folders in the MAPI public folder tree (also sometimes called the MAPI hierarchy). These are public folders that are defined in the public folder database, which may or may not be mail-enabled. There are a number of other public folder related tasks that are used to manage mail-enabled public folders and public folder permissions which will be covered in a later blog post.


The new-publicfolder task allows you to create a new public folder in the MAPI public folder tree (or hierarchy). For example, you could run the following command:

New-PublicFolder –Name Foo

That would create a folder named "Foo" at the top of the hierarchy (for those familiar with the term, it actually creates the folder "Foo" under IPM_SUBTREE). If no parent folder is specified, as in the case above, then the top of the hierarchy (represented as "\") is assumed. To subsequently create a child folder of the new "Foo" folder you would specify the parent folder with the "-path" parameter and a command like:

New-PublicFolder –Name FooChild –Path \Foo


The remove-publicfolder task is the opposite of new-publicfolder. It removes a Public Folder from the MAPI hierarchy. For example, you could run the following:

Remove-PublicFolder –Identity \Foo\FooChild

This will remove the folder named "FooChild" under the \Foo path. You will notice that the identity above is the full path to the public folder you want to remove. You can pass the identity in three different ways – as an object reference (ie through piping), as a full path (see above example), or as a LongTermEntryId (a globally unique identifier for a public folder). This is how Identity is used in all Public Folder tasks. Obviously, using the full path is easiest when working with the command shell manually, however, when scripting you are much better off using an object reference or LongTermEntryId if you have access to them because they are significantly faster than using the full path. This is because to calculate the folder path, the system must first look up each parent folder in the path in order to navigate to the correct folder. By providing the LongTermEntryId, the system can access the public folder directly, rather than having to look up each parent first. However, LongTermEntryId is only used primarily in scripting because it is a VERY long identifier and unwieldy to type and virtually impossible to remember.

If you ran the above command and the "FooChild" folder had any children, then the command would error out since you cannot delete a folder which has children. If you had wanted to remove "FooChild" and its children, then you would need to run the following:

Remove-PublicFolder –Identity \Foo\FooChild –recurse


The Set-PublicFolder command is used to manage properties on individual public folders such as Quotas, Age Limits and Replicas. For example you can run the following command:

Set-PublicFolder –Identity \Foo –MaxItemSize 10MB –Replicas {Server1\PFDB, Server2\PFDB}

That command will set the MaxItemSize property to 10MB for the folder, meaning that it won't accept items larger than 10MB. It also sets the replica list for the folder so it will be replicated to the public folder databases on Server1 and Server2.


The Get-PublicFolder command retrieves a public folder or set of public folders. The output of this task can then be piped to any of the other public folder related tasks (set/remove/update-publicfolder, get-publicfolderstatistics, add/remove/get-PublicFolderClientPermissions, add/remove/get-PublicFolderAdministrativePermission, or enable/disable/get/set-MailPublicFolder), making it a very useful way to define the scope of folders affected by some action you wish to take.

It can also be used to see the specific settings on a particular public folder. For example, you could run the following command:

Get-PublicFolder –Identity \Foo

That would return the folder named "Foo" at the top of the hierarchy. By default, it would show only the folder name and the path of the folder in the display output. If you wanted to see all of the properties associated with that public folder, such as Replicas, Quotas, and Age limits, you could run:

Get-PublicFolder –Identity \Foo | Format-List

That works for getting a specific folder where you already know the exact path. However, what if you wanted to see the children of a specific folder because you weren't quite sure of the exact name of the folder you wanted. You could run the following:

Get-PublicFolder –GetChildren

This will return the list of children under the top of the hierarchy. You will notice that no Identity was passed in that example. If no Identity is passed, it defaults to "\" which is the top of the hierarchy.

You can also perform a get recursively on a portion of the public folder tree by running the following command:

Get-PublicFolder –Identity \Foo –recurse

That will return "Foo" and all of its children (and all their children, etc) recursively. Note that this operation could take a long time and as it is written above is a pretty useless command (it only outputs these objects to the screen). However, this technique becomes very powerful when combined with piping to another command. For example if you wanted to set the MaxItemSize property on all public folders under \Foo, then you would run:

Get-PublicFolder –Identity \Foo –recurse | Set-PublicFolder –MaxItemSize 10MB

WARNING: Piping as shown above is the correct way to perform bulk operations on Public Folders. You never want to recursively get a set of public folders and store them in a variable. For example you should never run:

$Variable = Get-PublicFolder –Identity \Foo –recurse

Doing this will consume a large amount of memory on the server and is not recommended.

Finally, you may want to change the replica list on a set of system folders, say OABs. For example you might run the following:

Get-PublicFolder "\NON_IPM_SUBTREE\OFFLINE ADDRESS BOOK" –recurse | Set-PublicFolder –Replicas Server1

This command will set all of the OAB folders to be replicated only on Server1. You will notice that identity includes \NON_IPM_SUBTREE. This is the root of the "System Folders" tree.


The Update-PublicFolder task triggers replication of a particular folder from a particular replica. For example you could run the following:

Update-PublicFolder –Identity \Foo –Server Server1

This would trigger content replication of the folder named "Foo" at the top of the hierarchy using Server1 as the source.

Global Public Folder Management Tasks

These tasks are used to control the entire public folder hierarchy rather than a single public folder.


The Update-PublicFolderHierarchy task triggers replication of the public folder hierarchy from a particular server. For example you could run the following:

Update-PublicFolderHierarchy –Server Server1

This is just like the Update-PublicFolder example above, except instead of replicating the content of a specific folder, it replicates the public folder hierarchy information (ie – the list of folders and their configuration details rather than their content).


These tasks suspend or resume public folder content replication for the entire organization. This is useful if you are having a replication storm. This is the equivalent of a big, red "STOP" button for public folder content replication. Note that suspending content replication DOES NOT suspend hierarchy replication. Change to the public folder hierarchy will still be replicated. Neither of these commands take any parameters.

This is the first part of public folder management blog posts. A later public folder tasks post will discuss mail enabled public folders and public folder permissions.

- Jim Edelen

Comments (15)
  1. pesospesos says:

    Looking forward to it =)  Regarding public folders — we have been using public folders extensively for shared contact lists (DLs). We were hoping to move away from Public Folders since they will be deprecated with the next exchange version — however we are having trouble figuring out a good way to duplicate the functionality. We have set up a separate generic mailbox that is added to each user’s outlook to store shared calendars, contacts, and mail items. That’s great, and all the contact lists are there and accessible via contacts. However, they are not accessible from the address book (using the To: field or for auto-complete). Is there some way to add these lists to the list of address books so outlook will auto-search them the way we can with the lists in public folders? or is there another way to tackle this problem?  thanks!

  2. Greg Lambert says:

    I am the IT Officer for a medium sized police dept.  I am ready to upgrade from 2003 to 2007 but I need to know if public folders are available in 2007 OWA.  Most of our officers are not assigned a computer and use OWA exclusively from inside the station and from the mobile computers in the cars.  We use public calendars and they need to view them from OWA.  This is an important feature for us and I hope it’s still available.

  3. Greg: OWA Access to Public Folders is not available in Exchange 2007 RTM.

  4. Greg Lambert says:

    Do you think it will later on?  For right now I’ll use 2003 until I figure something else out.  Thanks.  Not sure why they left this out.  A lot of orgs use public folders.

  5. mike says:

    It’s great to see these Public Folder commands in Ex2007, which Ex2003 lacked except when using the PFDAVADMIN tool.

    Question for Jim/Microsoft:-  Will the PFDAVADMIN utility still work in Ex2007??

     I found the tool very powerful & invaluable for managing PF’s+related permissions…

  6. Exchange says:

    Mike, the answer to your question is yes. :)

  7. EDDIE says:

    How can you forcefully remove an Exchange 2007 Public Folder database if the DB itself has become corrupt?

    I’m having a very hard time removing the public folder DB either through the management console or power shell.  It’s the last public folder, and all I want to do is remove it.

    The problem is, since whatever files are corrupt, I can not mount the DB, therefore every which way I try to remove it I get the same error that the DB must be mounted.

  8. Johan Lysén says:


    Pls add support for Public Folder Access from OWA some near Exchange 2007 update – we can´t upgrade to E2K7 at this moment just because of this drawback…

    /Johan Lysén

  9. Greg Lambert says:

    Same here Johan.  Not everyone in my department has a PC assigned to them so they use OWA as their primary client.  I have Exchange 2007 sitting in a drawer until I get public folders in OWA.

  10. Anonymous says:

    I have previously listed the progress we’ve been making in posting ITPro focused Systems Management blog

  11. Wim says:

    A question for Eddie: Have you solved the issue of not being able to remove the PF? We have a case of coexistence here with EX2003, so in our case the EX2007 PF store is not the last in our environment, but for some reason there was no PF file created during install, therefore we are unable to mount (why doesn’t EX2007 create a new file like EX2003 did??) and also we are unable to delete it because is says it wants to check if replicas exist and it cannot do this because it is not mounted (chicken and the egg story).

    Any help would be appreciated!

  12. AFOINT says:

    Wim or Eddie, I have the exact same issue.  Added Exchange 2007 to an existing Exchange 2003 Infrastructure, PF store was created but with no file, can’t mount or delete, therefore can’t support Outlook 2003 with user’s whose mailboxes have been upgraded to EX2007, because of no Public Folder, unless there’s a way to point it to the original Public Folder for Exchange 2003???

  13. Garry says:

    Win, Eddie, AFOINT,

    I have the same issue also – I wish some MS peeps would help us out. I cannot remove the last PF to recreate it. It is corrupt and I am completely stuck unable to move forward or back. This seems much harder in Ex 2007…

  14. ninob says:

    Garry, Win, Eddie, AFOINT,

    I will say that I am a bit confused as to what problem you are having exactly… are you having the problem of removing the PF store or the last PF from the store (as in last replica of the folder)?

    What is the error you get when trying to mount the PF store??

  15. JIm Roberts says:

    I am the IT Manager for a medium sized

    law firm. We have several users that work

    away from the office.  They use OWA

    exclusively.  We used to share the

    calendars using IMail, a product of

    IPSwitch.  Now the new improved version

    of Exchange, 2007 does not provide access

    to Shared Calendars.  This responses from

    the Microsft reps in this Blog are just

    not the correct one.  Fix it please, make

    it work.  

Comments are closed.

Skip to main content