8 Useful Public Folder Management Scripts in Exchange Server 2010

Written by Paul Cunningham on May 28, 2010

serversExchange Server 2010 ships with eight very useful Powershell scripts that can be used for managing Public Folders.  The scripts perform tasks relating to Public Folder replicas and permissions that are otherwise not easily manageable through the management console or shell.

Each of the scripts is developed for making recursive changes to public folders.  This means that when you target the script at a particular folder, or the root of the public folder tree, it applies the action to all subfolders of that folder.

These scripts only apply to servers running Exchange 2007 or Exchange 2010, you can not specify a server running older versions of Exchange Server.

Managing Public Folder Replicas

These public folder replica scripts are used to manage which servers hold replica data for the public folders.  When a script does not specify a server to run against it will default to the nearest convenient server for the public folder being targeted.

AddReplicaToPFRecursive.ps1 – this script adds a server to the replica list for a public folder and its subfolders.

For example, to add EXCH02 as a replica for all public folders on server EXCH01 starting at the root folder of \ you would run this command.

AddReplicaToPFRecursive.ps1 –Server EXCH01
 –TopPublicFolder \ –ServerToAdd EXCH02

RemoveReplicaFromPFRecursive.ps1 – this script will remove a server from the list of replicas for a folder and its subfolders.  A server must have all of its public folder replicas removed before it can be decommissioned.

For example, to remove EXCH02 as a replica for all public folders on EXCH01 starting at the root folder you would run this command.

RemoveReplicaFromPFRecursive.ps1 –Server EXCH01
 –TopPublicFolder \ –ServerToRemove EXCH02

ReplaceReplicaOnPFRecursive.ps1 – this script replaces a server in the replica list of the public folders with another server.  This is useful when public folders are already replicated to more than one server, and one of those servers is being replaced.

For example, to replace EXCH02 with EXCH03 as a replica for the Branch folder and all subfolders you would run this command.

ReplaceReplicaOnPFRecursive.ps1 –TopPublicFolder \Branch
 –ServerToAdd EXCH03 –ServerToRemove EXCH02

MoveAllReplicas.ps1 – this script replaces all of the replicas on one server with the new server specified.  You do not need to target a particular parent folder with this script, it will check the entire public folder tree when making the replacements.  This is useful when you want to move all of the replicas from one server to another at once, whereas the ReplaceReplicaOnPFRecursive.ps1 script allows it to be done in a staged manner.

For example, to move all replicas from EXCH01 to EXCH02 you would run this command.

MoveAllReplicas.ps1 –Server EXCH01 –NewServer EXCH02

Managing Public Folder Client Permissions

These scripts are used to manage the client (or end-user) permissions to public folders.  When a script does not specify a server to run against it will default to the nearest convenient server for the public folder being targeted.

AddUserstoPFRecursive.ps1 – this script grants the specified user permission to a public folder and its subfolders.  You can grant permissions to a user or to a group, as long as they are mail-enabled.

For example, to add John Smith as a Reviewer of the “Branch” folder and subfolders you would run this command.

AddUsersToPFRecursive.ps1 –TopPublicFolder \Branch
 –User “johnsmith” –Permissions Reviewer

RemoveUserFromPFRecursive.ps1 – this script revokes the specified user permission to a public folder and its subfolders.

For example, to remove John Smith from the “\Branch” folder and subfolders you would run this command.

RemoveUserFromPFRecursive.ps1 –TopPublicFolder \Branch
 –User “johnsmith”

ReplaceUserPermissionOnPFRecursive.ps1 – this script will replace a specified user’s existing permissions on a public folder and all subfolders with a new set of permissions.  This is useful when you want to raise or lower the permissions that a user currently has to a set of public folders.

For example, to change John Smith from being a Reviewer of the \Branch folder and all subfolders to being a Publishing Editor you would run this command.

ReplaceUserPermissionOnPFRecursive.ps1 –TopPublicFolder
 \Branch –User “johnsmith” –Permissions PublishingEditor

ReplaceUserWithUserOnPFRecursive.ps1 – this script replaces an existing user’s permissions to a public folder and all subfolders with another user.  This is useful if there has been a staff change and you wish to grant the same access to a new user that the previous user had.

For example, to replace John Smith with Peter Brown as the Publish Editor of the \Branch public folder and all subfolders you would run this command.

ReplaceUserWithUserOnPFRecursive.ps1 –TopPublicFolder \Branch
 –UserOld “johnsmith” –UserNew “peterbrown”
Subscribe to my RSS feed

Leave a Comment

Comment Policy