Scripts for Managing Public Folders in the Exchange Management Shell

Scripts for Managing Public Folders in the Exchange Management Shell

Below is an article published by Microsoft on the different scripts available to manage public folders. This can come in useful in a number of scenarios including How to move Public Folders when moving to a new Exchange Server. The original article can be found here: http://technet.microsoft.com/en-us/library/aa997966(v=exchg.140).aspx

 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 2010 and described in this topic (as well as other scripts), or you can write your own scripts.
Note:
The Shell doesn’t load scripts automatically. You must precede all scripts with . (a period, followed by a backslash). For example, to run the AggregatePFData.ps1 script, type .AggregatePFData.ps1.

The collection of Shell scripts described in this topic is installed, by default, at <Exchange Installation Path>v14 ServerScripts.

C:Program FilesMicrosoftExchange ServerV14Scripts

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

Looking for other management tasks related to public folders? Check out Managing Public Folders.

 

The following table lists the administrative scripts included with Exchange 2010.

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 Mailbox server that has a public folder database. If you don’t use the Server parameter to specify a server, the script defaults to the local server.
  • TopPublicFolder   (Required) This parameter specifies the identity of the folder 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.
Aggregate data across all public folder replicas. AggregatePFData.ps1 This script aggregates and captures information collected from the following cmdlets:

  • Get-PublicFolderItemStatistics
  • Get-PublicFolderStatistics
  • Get-PublicFolder

The following information is aggregated at the public folder level, and not at the item level:

  • Last user access and last user modification times
  • Owner of the public folder
  • Other properties such as MailEnabled, HasRules, ItemCount, FolderType, HasModerator, and TotalItemSize

This script accepts the following parameters:

  • Help   This parameter displays the Help file for the script.
  • Public Folder   (Required) This parameter specifies the identity of the public folder.

For more information, see View Public Folder Item Statistics.

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 isn’t 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 isn’t 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 Mailbox server that has a public folder database. If you don’t use the Server parameter to specify a server, the script defaults to the local server.
  • TopPublicFolder   (Required) This parameter specifies the identity of the folder 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 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 isn’t 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 Mailbox server that contains a public folder database. If you don’t use the Server parameter to specify a server, the script defaults to the local server.
  • TopPublicFolder   (Required) This parameter specifies the identity of the folder 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 2010.

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 specified in the script. 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 Mailbox server that contains a public folder database. If you don’t use the Server parameter to specify a server, the script defaults to the local server.
  • TopPublicFolder   (Required) This parameter specifies the identity of the folder 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 don’t contain permissions for the user aren’t modified. 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 Mailbox server that has a public folder database. If you don’t use the Server parameter to specify a server, the script defaults to the local server.
  • TopPublicFolder   (Required) This parameter specifies the identity of the folder 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 don’t contain permissions for the user aren’t modified. 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 Mailbox server that contains a public folder database. If you don’t use the Server parameter to specify a server, the script defaults to the local server.
  • TopPublicFolder   (Required) This parameter specifies the identity of the folder 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. 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 Mailbox server that contains a public folder database. If you don’t use the Server parameter to specify a server, the script defaults to the local server.
  • TopPublicFolder   (Required) This parameter specifies the identity of the folder at the top of the public folder tree.
  • User   (Required) This parameter specifies the identity of the user from whom to remove client permissions.
    Note:
    The users Default and Anonymous can’t be removed from the permissions list. Any attempt to do so effectively replaces their permissions with None.
Enhanced by Zemanta

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.