Exchange 2003 Public Folder Replica list

Posted by Niall on Stack Overflow See other posts from Stack Overflow or by Niall
Published on 2010-04-20T11:09:34Z Indexed on 2010/04/20 11:13 UTC
Read the original article Hit count: 347

Filed under:
|
|

Hi,

I am trying to update a replica list on a Exchange 2003 public folder. I am using the WMI namespace exchange_publicfolder to try and add an Exchange server (using the servers DN) to the AddReplica procedure. Every time I run this I get an invalid parameter as an exception.

Below is the code that I am using to do this.

      WMI.Connect(Server, credentials)

  Using WMISearcher As New ManagementObjectSearcher(WMI.Scope, & _ 
            New ObjectQuery(String.Format("SELECT * FROM Exchange_Publicfolder WHERE path='{0}'", Name)))
    Using PublicFolder As ManagementObjectCollection = WMISearcher.Get
      For Each Folder As ManagementObject In PublicFolder
        Dim BaseFolder As ManagementBaseObject = Folder.GetMethodParameters("AddReplica")
        BaseFolder("path") = ServerDN
        Folder.InvokeMethod("AddReplica", BaseFolder, Nothing)
      Next
    End Using
  End Using

I have used WMI before and I can see that the call is connecting to the correct public folder because i can itterate through the properies once the query has executed. I am not sure what I am doing wrong here.

If anyone has any ideas or comments the please let me know.

Thanks

Niall

© Stack Overflow or respective owner

Related posts about exchange-2003

Related posts about wmi