Recipe9.4.Forcing Public Folder Replication


Recipe 9.4. Forcing Public Folder Replication

Problem

You've made changes to a public folder and you want those changes immediately replicated.

Solution

Using a graphical user interface

To force replication of a folder, do the following:

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

  2. In the left pane, expand the appropriate Administrative Groups container; this should be the administrative group that contains the server that contains the replica whose contents you want to send. This will typically be the most up-to-date replica.

  3. Expand the Folders and Public Folders nodes.

  4. Right-click the folder you want and select Send Contents.

  5. When the Send Contents dialog box appears, select the source and target servers and fill in the number of days for which you want changes sent.

  6. Click OK.

  7. When the confirmation dialog box appears, click Yes.

Using VBScript
' This code sends the contents of all public folders on the specified ' server to any other servers that have those folders in their replica list.  ' ------ SCRIPT CONFIGURATION ------  strComputerName = "<serverName>" ' ------ END CONFIGURATION ---------   strE2K3WMIQuery = "winmgmts://" & strComputerName &_     "/root/MicrosoftExchangeV2"      Set folderList = GetObject(strE2K3WMIQuery).InstancesOf("Exchange_PublicFolder")      ' Get the replica count. For any folder that has multiple replicas,    ' force the replica *on this server* to request any changes that it    ' knows of but hasn't gotten.   For each Exchange_PublicFolder in folderList       replicaCount = UBound(Exchange_PublicFolder.ReplicaList)+1       WScript.Echo "Folder " & Exchange_PublicFolder.Name & " has " & _        replicaCount & " replicas."        If (replicaCount > 1) Then            WScript.Echo "   Synchronizing " & Exchange_PublicFolder.Path          Exchange_PublicFolder.Synchronize       End If       Next      WScript.Echo "Done processing folders."

If you don't want to force replication of all folders on a server, you can use the same method to replicate an individual folder:

' This code forces replication of the contents of a specified folder. ' ------ SCRIPT CONFIGURATION ------  strComputerName = "<serverName>"  strPubFolderPath = "<folderPath>"     ' e.g., "/Book Suggestions/"    ' ------ END CONFIGURATION ---------   strE2K3WMIQuery = "winmgmts://" & strComputerName &_     "/root/MicrosoftExchangeV2"      ' query for the specific folder we want   Set wmiService = GetObject(strE2K3WMIQuery)   query = "Select * From Exchange_PublicFolder" & " Where Path='" & _      strPubFolderPath & "'"   Set targetFolder = wmiService.ExecQuery(query)     ' if we have multiple replicas, send changes from the first   ' replica to all others   For Each folder In targetFolder       replicaCount = UBound(folder.ReplicaList)+1     WScript.Echo "Folder " & folder.Name & " has " & replicaCount & _         " replicas."     If (replicaCount > 1) then           WScript.Echo "   Sending changes from " & folder.Path _         & " to " & folder.ReplicaList(0)         folder.SendChanges 30, folder.ReplicaList         Folder.Put_     End If    Next   WScript.Echo "Done processing folders."

Discussion

In normal operation, Exchange will replicate public folder contents without any help or intervention from you. However, there may be times when replication isn't working fast enough, in which case, you can force replicated updates to be sent or requested.

Using a graphical user interface

From ESM, you can send contents from a selected replica to one or more target replicas; any changes to the source in the time window you specify are packaged as replication messages and sent using the normal mechanism.

Using VBScript

The two scripts in this recipe show two different approaches. The first one uses the Synchronize() method, which tells Exchange to request the actual content for any update it doesn't yet have. This works because the folder may have a list of content updates (or, more precisely, change numbers) for which it hasn't actually gotten the changes. Synchronize( ) just brings the two into harmony by requesting content backfills for the change numbers whose content isn't present yet. The second script uses SendChanges() , which allows you to force updated content from one replica to be sent to other, specified, replicas. In this case, the script sends changes from the first replica of the "Book Suggestions" folder to all other replicas. Because the ordering of replicas may change between folders on different servers, this script could be enhanced by having it check to see which replicas the changed content is being sent to.

See Also

Recipe 9.5 for replicating the public folder hierarchy, Recipe 9.10 for working with a server's replica list, Recipe 9.13 for controlling replication settings, and MSDN: WMI Exchange_PublicFolder class



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