Exchange Server Cookbook: For Exchange Server 2003 and Exchange 2000 Server
Recipe 9.9. Finding All Replicas of a Public Folder
Problem
You want to know where all the replicas for a given public folder are. Solution
Using a graphical user interface
Using a command-line interface
Use the LISTREPLICAS switch for PFAdmin, which also requires the name of the profile and the name of the folder (or ALL for all folders). Here's an example (use pfadmin listreplicas ? for more detailed help): > pfadmin exAdmin LISTREPLICAS "Book Suggestions"
Using VBScript
' This code retrieves the list of all replicas for a specified folder ' ------ SCRIPT CONFIGURATION ------ strComputerName = "<serverName>" 'e.g., "cyclone" 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) ' list all of its replicas For Each folder In targetFolder replicaCount = UBound(folder.ReplicaList)+1 WScript.Echo "Folder " & folder.Name & " has " & replicaCount & _ " replicas." For i = 0 To replicaCount-1 WScript.Echo " Replica " & i & "==> " & folder.ReplicaList(i) next Next WScript.Echo "Done processing folders."
Discussion
Each folder has a replica list associated with it; this list isn't stored with the folder (as you might expect), but as part of the associated hierarchy data in the store. That's good news, since it makes it simple to retrieve the replica list for a folder from any Exchange server in the organization. However, the replica list doesn't include any information about the replication status of folders, so you can't use it to tell whether a given replica is up to date. Using VBScript
Every folder in the organization is listed in the public folder hierarchy, so finding all the replicas can be done in two ways: ask each server whether it contains a replica of the desired folder, or ask WMI to find the specified folder and then query its replica list. The second method is much simpler, and more efficient to boot. Accordingly, that's what this script does; for each folder returned in the WMI query, the script displays the contents of the replica list for that folder. See Also
Recipe 9.10 for changing individual servers' replica lists |