Recipe9.10.Working with a Specific Server s Replica List


Recipe 9.10. Working with a Specific Server's Replica List

Problem

You want to manipulate the replica list on an individual server; this manipulation might include:

  • Adding replicas of existing folders to the server

  • Removing existing replicas from the server

  • Querying the server to find out what replicas it currently contains

Solution

Using a graphical user interface

To add or remove replicas, do the following:

  1. Launch the Exchange System Manager (Exchange System Manager.msc).

  2. In the left pane, expand the appropriate Administrative Groups container.

  3. Expand the Folders and Public Folders nodes.

  4. Right-click the target folder and select Properties.

  5. Switch to the Replication tab.

  6. Click the Add button; when the Select a Public Store dialog box appears, select the server where you want the new replica to be housed and click OK.

  7. Click OK again.

  8. Wait for the public folder content to replicate by checking the folder contents.

  9. Verify that the folder replica has appeared in the folder list of the target server.

  10. Optionally, if you want to remove the original replica, repeat steps 2-5, select the original replica, and click Delete.

To see which replicas a server contains, do the following:

  1. Launch the Exchange System Manager (Exchange System Manager.msc).

  2. In the left pane, expand the appropriate Administrative Groups container.

  3. Expand the server's node, then expand the storage group that contains the public folder store of interest.

  4. Expand the target public folder store.

  5. Select the Public Folder Instances node. The right ESM pane will display the replicas present on that server.

  6. Optionally, right-click in the right ESM pane and select Export List to save the replica list as a tab-delimited text file.

To export the list of replicas from a server, do the following:

  1. Open PFDAVAdmin (PFDAVAdmin.exe).

  2. From the menu select File Connect; when the connection dialog appears, enter the name of the server whose replica list you want to export (and credentials if necessary).

  3. Select the Tools Options from the menu and make sure that the Enable logging to file checkbox is set. Specify a log file path if necessary and click OK.

  4. Select Tools Export Replica Lists from the menu. When the PFDAVAdmin Export Options dialog box appears, select the scope of the export (the default is to export replicas for all public folders, but you can limit the export to a subscope if you prefer). Click OK.

  5. When the Save As dialog appears, pick a location and name for the export file, and click Save.

Using VBScript
' This code finds all replicas on a server. ' ------ SCRIPT CONFIGURATION ------  strComputerName = "<serverName>" '     e.g., "cyclone" ' ------ END CONFIGURATION ---------   strE2K3WMIQuery = "winmgmts://" & strComputerName &_     "/root/MicrosoftExchangeV2"      ' Get all the public folders in the MAPI TLH.   ' For each folder, check to see if it has a local replica.    Set folderList = GetObject(strE2K3WMIQuery).InstancesOf( _                                      "Exchange_PublicFolder")      WScript.Echo "Folders on server " & strComputerName   folderCount = 0   For each Exchange_PublicFolder in folderList     if (true = Exchange_PublicFolder.HasLocalReplica) then         WScript.Echo "   + " & Exchange_PublicFolder.Name           folderCount = folderCount + 1     end if       Next WScript.Echo "   " & folderCount & " folders total."

If you want to make a given server into a public folder server, this script will force the server to have replicas of all public folders in the MAPI TLH (provided the server already has a public folder database on it:

' This code creates local replicas for all folders in the MAPI TLH ' ------ SCRIPT CONFIGURATION ------  strComputerName = "<serverName>"        'e.g., "CONT-EXBE01"  strPubMDBPath = "<publicMDBURL>" ' ------ END CONFIGURATION ---------   strE2K3WMIQuery = "winmgmts://" & strComputerName &_     "/root/MicrosoftExchangeV2"      ' Get all the public folders in the MAPI TLH.   ' For each folder, check to see if it has a local replica.    ' If not, create one using the defined path name   Set folderList = GetObject(strE2K3WMIQuery).InstancesOf(_                                            "Exchange_PublicFolder")      WScript.Echo "Creating local replicas on server " & strComputerName   For each Exchange_PublicFolder in folderList   if (true = Exchange_PublicFolder.HasLocalReplica) Then     WScript.Echo "   - " & Exchange_PublicFolder.Name & _                  ": already local"   else     Exchange_PublicFolder.AddReplica(strPubMDBPath)     WScript.Echo "   + " & Exchange_PublicFolder.Name   end if       Next WScript.Echo "Done creating replicas in " & strPubMDBPath & "."

Discussion

Because every server has its own local copy of the hierarchy, it's fairly straightforward to find out which folders exist; each store already knows what folders it contains, and that knowledge forms the basis of the replica list. This list is directly exposed in ESM, but to get or modify replica information from within a script, you have to either select the folders you want or iterate over all of them. There's no "replica list" object per se.

Using VBScript

The two scripts in this recipe accomplish very different tasks. The first queries for all Exchange_PublicFolder instances on the local server, which is a simple way of getting a copy of the public folder hierarchy. It then iterates over each folder in the hierarchy, printing the names of those that have local replicas. The second uses the same query to get the hierarchy, but then for any folder that does not have a local replica, it adds a local replica. This is a simple way to make a dedicated public folder server, or to create a server that contains backup copies of all your public folders.

See Also

Recipe 9.9 for finding all replicas of a specified folder



Exchange Server Cookbook
Exchange Server Cookbook: For Exchange Server 2003 and Exchange 2000 Server
ISBN: 0596007175
EAN: 2147483647
Year: 2006
Pages: 235

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net