Export (0) Print
Expand All

Scripts for Managing Public Folders in the Exchange Management Shell

 

Applies to: Exchange Server 2007 SP3, Exchange Server 2007 SP2, Exchange Server 2007 SP1, Exchange Server 2007

Topic Last Modified: 2007-03-27

Running scripts in the Exchange Management Shell can make public folder administration faster and easier by automating complex or frequently performed tasks. You can use scripts that are installed with Microsoft Exchange Server 2007 and described in this topic (as well as other scripts), or you can write your own scripts.

The collection of Exchange Management Shell scripts that are described in this topic are installed, by default, at C:\Program Files\Microsoft\Exchange Server\Scripts.

To run these scripts, the account you use must be delegated the following:

  • Exchange Server Administrator role and local Administrators group for the target server

For more information about permissions, delegating roles, and the rights that are required to administer Exchange Server, see Permission Considerations.

For more information about using and writing scripts in Exchange 2007, see Scripting with the Exchange Management Shell.

The following table lists the server management scripts that are included with Exchange 2007.

 

Task Script Description

Add a server to the replication list.

AddReplicaToPFRecursive.ps1

This script adds a new server to the replication list for a public folder and all the folders beneath it in the hierarchy. If the server is already listed in the replication list for a folder, nothing is changed for that folder. This script accepts the following parameters:

  • Help   This parameter displays the Help file for the script.
  • Server   (Optional) This parameter specifies the server to operate against. This server must be an Exchange 2007 Mailbox server that has a public folder database. If you do not use the Server parameter to specify a server, the script will default to the local server.
  • TopPublicFolder   (Required) This parameter specifies the identity of the folder that is at the top of the public folder tree.
  • ServerToAdd   (Required) This parameter specifies the server identity to add to the replica list. This server must contain a public folder database.

Remove a server from the replication list.

RemoveReplicaFromPFRecursive.ps1

This script removes a server from the replication list for a public folder and all the folders beneath it in the hierarchy.

If the server is not listed in the replication list for a folder, nothing is changed for that folder.

If the server is the only server on the replication list, the list is not changed. This script accepts the following parameters:

  • Help   This parameter displays the Help file for the script.
  • Server   (Optional) This parameter specifies the server to operate against. This server must be an Exchange 2007 Mailbox server that has a public folder database. If you do not use the Server parameter to specify a server, the script will default to the local server.
  • TopPublicFolder   (Required) This parameter specifies the identity of the folder that is at the top of the public folder tree.
  • ServerToRemove   This parameter specifies the server identity to remove from the replica list. This server must have a public folder database.

Replace a server in the replication list.

MoveAllReplicas.ps1

This script replaces a server with a new server in the replication list for all public folders, including system folders. This script accepts the following parameters:

  • Help   This parameter displays the Help file for the script.
  • Server   (Required) This parameter specifies the server to remove. This server must be an Exchange 2007 Mailbox server that contains a public folder database.
  • NewServer   (Required) This parameter specifies the identity of the server to add to the replica list. This server must contain a public folder database.

Replace a server in the replication list with a new server.

ReplaceReplicaOnPFRecursive.ps1

This script replaces a server with a new server in the replication list for a public folder and all the folders beneath it in the hierarchy. If the server that you want to remove is not listed in the replication list for a particular folder, nothing is changed for that folder. This script accepts the following parameters:

  • Help   This parameter displays the Help file for the script.
  • Server   (Optional) This parameter specifies the server to operate against. This server must be an Exchange 2007 Mailbox server that contains a public folder database. If you do not use the Server parameter to specify a server, the script will default to the local server.
  • TopPublicFolder   (Required) This parameter specifies the identity of the folder that is at the top of the public folder tree.
  • ServerToRemove   This parameter specifies the server identity to remove from the replica list. This server must contain a public folder database.
  • ServerToRemove   (Required) This parameter specifies the identity of the server to remove from the replica list. This server must contain a public folder database.

The following table lists the user management scripts included with Exchange 2007.

 

Task Script Description

Add a user to the client permissions list.

AddUsersToPFRecursive.ps1

This script adds a user and that user's permissions to the client permissions list for a public folder and all the folders beneath it in the hierarchy. If the user is already listed in the client permissions list for a folder, the user's permissions are updated to the new set that is specified in the script.

  • Help   This parameter displays the Help file for the script.
  • Server   (Optional) This parameter specifies the server to operate against. This server must be an Exchange 2007 Mailbox server that contains a public folder database. If you do not use the Server parameter to specify a server, the script will default to the local server.
  • TopPublicFolder   (Required) This parameter specifies the identity of the folder that is at the top of the public folder tree.
  • User   (Required) This parameter specifies the identity of the user to whom to add client permissions.
  • Permissions   (Required) This parameter specifies the client permissions to apply to the user.

Replace a user with a new user in the client permissions list.

ReplaceUserWithUserOnPFRecursive.ps1

This script replaces a user with a new user in the client permissions list for a public folder and all the folders beneath it in the hierarchy. Existing permissions for the first user are retained. Public folders that do not contain permissions for the user are not modified.

  • Help   This parameter displays the Help file for the script.
  • Server   (Optional) This parameter specifies the server to operate against. This server must be an Exchange 2007 Mailbox server that has a public folder database. If you do not use the Server parameter to specify a server, the script will default to the local server.
  • TopPublicFolder   (Required) This parameter specifies the identity of the folder that is at the top of the public folder tree.
  • UserOld   (Required) This parameter specifies the identity of the user from whom to remove client permissions.
  • UserNew   (Required) This parameter specifies the identity of the user to whom to add client permissions.

Replace a user's permissions.

ReplaceUserPermissionOnPFRecursive.ps1

This script replaces the permissions of a user in the client permissions list for a public folder with a new set of permissions. It also replaces the permissions for all the folders in the hierarchy beneath that folder. Public folders that do not contain permissions for the user are not modified.

  • Help   This parameter displays the Help file for the script.
  • Server   (Optional) This parameter specifies the server to operate against. This server must be an Exchange 2007 Mailbox server that contains a public folder database. If you do not use the Server parameter to specify a server, the script will default to the local server.
  • TopPublicFolder   (Required) This parameter specifies the identity of the folder that is at the top of the public folder tree.
  • User   (Required) This parameter specifies the identity of the user for whom to replace client permissions.
  • Permissions   (Required) This parameter specifies the client permissions to apply to the user.

Remove a user from the client permissions list.

RemoveUserFromPFRecursive.ps1

This script removes a user from the client permissions list for a public folder and from all the folders beneath it in the hierarchy.

  • Help   This parameter displays the Help file for the script.
  • Server   (Optional) This parameter specifies the server to operate against. This server must be an Exchange 2007 Mailbox server that contains a public folder database. If you do not use the Server parameter to specify a server, the script will default to the local server.
  • TopPublicFolder   (Required) This parameter specifies the identity of the folder that is at the top of the public folder tree.
  • User   (Required) This parameter specifies the identity of the user from whom to remove client permissions.
    noteNote:
    The users "Default" and "Anonymous" cannot be removed from the permissions list. Any attempt to do so effectively replaces their permissions with "None."

To learn more about public folders, see Understanding Public Folders.

For more information about public folder permissions, see Configuring Public Folder Permissions.

For more information about managing public folders, see Managing Public Folders.

For more information about using scripts to manage public folders in Exchange 2007, see Scripting with the Exchange Management Shell.

For more information about using the Exchange Management Shell, see Using the Exchange Management Shell.

To ensure that you are reading the most up-to-date information and to find additional Exchange Server 2007 documentation, visit the Exchange Server TechCenter.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft