Viewing a Custom Connector in the Queue Viewer
Viewing a Custom Connector in the Queue Viewer
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
The Microsoft® Exchange Server 2003 Queue Viewer will display custom gateway connector queues that meet the following criteria:
- The Microsoft Active Directory® object must be derived from the mailgateway class.
- The computername attriubte must match the Network Basic Input/Output System (NetBIOS) name for the server the connector is on.
- The legacyExchangeDN attribute must be set on the connector object.
- The heuristics attribute must have the HAS_EDK_MAPI_CONNECTOR (0x01000000) bit set on it.
The first thee criteria are set when the Exchange 2000 Server sample gateway connector is installed. The script below sets the fourth criteria allowing the Queue Viewer to display the queues.
The following script searches for all installed sample gateway connectors (searches on objectcategory=msExchSgw) under the administrative group container of Active Directory. If the heuristics attribute is empty, it is set to hex value 0x01000000. If the heuristics attribute value is already set, the script sets the (0x01000000) bit on it.
VB Script
Dim Conn Dim Com Dim Rs Dim strQuery Dim strAdsPath Dim objSGW Dim OrgName Dim i Dim x ' Get the configuration naming context. Set iAdRootDSE = GetObject("LDAP://RootDSE") varConfigNC = iAdRootDSE.Get("configurationNamingContext") ' Open the connection. Set Conn = CreateObject("ADODB.Connection") Conn.Open "Provider=ADsDSOObject;" Set Com = CreateObject("ADODB.Command") Com.ActiveConnection = Conn ' Get the first subcategory under the Exchange Organization container. strQuery = "<LDAP://CN=Microsoft Exchange,CN=Services," & varConfigNC & _ ">;(objectCategory=msExchOrganizationContainer);name,cn,distinguishedName,ADsPath;onelevel" Com.CommandText = strQuery Set Rs = Com.Execute If Rs.EOF = True then WScript.Echo "You do not have the required permissions." Else OrgName = Rs.Fields("distinguishedName") End If ' Clean up. Rs.Close Conn.Close Set Rs = Nothing Set Com = Nothing Set Conn = Nothing ' Open the connection. Set Conn = CreateObject("ADODB.Connection") Conn.Open "Provider=ADsDSOObject;" Set Com = CreateObject("ADODB.Command") Com.ActiveConnection = Conn ' Build an LDAP search command that looks for an objectCategory ' that matches sample gateway (ms-Exch-SGW) in the administrative group container of Active Directory. strQuery = "<LDAP://CN=Administrative Groups," & OrgName & _ ">;(objectCategory=msExchSgw);name,cn,distinguishedName,ADsPath;subtree" Com.ActiveConnection = Conn Com.CommandText = strQuery On Error resume next Set Rs = Com.Execute If (Err.Number = &H80040E37) Then MsgBox "You do not have proper permissions." Else If Rs.EOF = True Then MsgBox "There are no sample gateway connectors installed." Else ' Iterate through the results. While Not Rs.EOF strAdsPath = Rs.Fields("ADsPath") Set objSGW = GetObject(strAdsPath) On Error resume next i = objSGW.Get("heuristics") 'If the heuristics is not set, you get the following error. If (Err.Number = &H8000500D) Then x = &H1000000 Else x = CLng(i) x = x Or &H1000000 End If objSGW.Put "heuristics", x objSGW.SetInfo MsgBox "Modified the sample gateway connector for the following DN: " & _ objSGW.Get("distinguishedName") Rs.MoveNext Wend MsgBox Rs.RecordCount & " connectors were modified" End If End If ' Clean up. Rs.Close Conn.Close Set Rs = Nothing Set Com = Nothing Set Conn = Nothing
Send us your feedback about the Microsoft Exchange Server 2003 SDK.
Build: June 2007 (2007.618.1)
© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.