Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Wed, 5 Oct 2005 14:18:43 +0530,    group: microsoft.public.platformsdk.active.directory        back       


How to get data from ms-Exch-Protocol-Cfg-SMTP-Routing-Sources using ADSI - COM   
Hi,

I am having trouble to fetch the IP and Port for Virtual SMTP server of an
MS Exchange. I am able to retrive the data using a  VB script ( Given
below ), but there is no clue of how to do the same in C++ using ADSI.

Any pointers are appritiated.

Thanks
Nibu.

VB Script
****************************************************************************
****************************************************************************
**
set conn = createobject("ADODB.Connection")
set com = createobject("ADODB.Command")
Set iAdRootDSE = GetObject("LDAP://RootDSE")
strNameingContext = iAdRootDSE.Get("configurationNamingContext")
Conn.Provider = "ADsDSOObject"
Conn.Open "ADs Provider"
vsQuery = "<LDAP://" & strNameingContext &
">;(objectCategory=protocolCfgSMTPServer);name,distinguishedName;subtree"
Com.ActiveConnection = Conn

Com.CommandText = vsQuery
Set Rs = Com.Execute

While Not Rs.EOF
    wscript.echo rs.fields("distinguishedName")
    strstmsrv = "LDAP://" & rs.fields("distinguishedName")

    set svsSmtpserver = getobject(strstmsrv)
    wscript.echo "ServerName:" &
mid(svsSmtpserver.distinguishedName,instr(svsSmtpserver.distinguishedName,"C
N=Protocols,")+16,instr(svsSmtpserver.distinguishedName,",CN=Servers")-
(instr(svsSmtpserver.distinguishedName,"CN=Protocols,")+16))
    wscript.echo "Virtual Server Name:" & svsSmtpserver.adminDisplayName
    wscript.echo "Max Message Size Limit:" &
svsSmtpserver.msExchSmtpMaxMessageSize/1024 & " KB"
    wscript.echo "IP:" & svsSmtpserver.msExchServerBindings
    wscript.echo
    rs.movenext
wend

****************************************************************************
****************************************************************************
**
date: Wed, 5 Oct 2005 14:18:43 +0530   author:   Nibu Jorim

Re: How to get data from ms-Exch-Protocol-Cfg-SMTP-Routing-Sources using ADSI - COM   
You multi-posted, I responded to this in another newsgroup.

--
Joe Richards Microsoft MVP Windows Server Directory Services
www.joeware.net


Nibu Jorim wrote:
> Hi,
> 
> I am having trouble to fetch the IP and Port for Virtual SMTP server of an
> MS Exchange. I am able to retrive the data using a  VB script ( Given
> below ), but there is no clue of how to do the same in C++ using ADSI.
> 
> Any pointers are appritiated.
> 
> Thanks
> Nibu.
> 
> VB Script
> ****************************************************************************
> ****************************************************************************
> **
> set conn = createobject("ADODB.Connection")
> set com = createobject("ADODB.Command")
> Set iAdRootDSE = GetObject("LDAP://RootDSE")
> strNameingContext = iAdRootDSE.Get("configurationNamingContext")
> Conn.Provider = "ADsDSOObject"
> Conn.Open "ADs Provider"
> vsQuery = "<LDAP://" & strNameingContext &
> ">;(objectCategory=protocolCfgSMTPServer);name,distinguishedName;subtree"
> Com.ActiveConnection = Conn
> 
> Com.CommandText = vsQuery
> Set Rs = Com.Execute
> 
> While Not Rs.EOF
>     wscript.echo rs.fields("distinguishedName")
>     strstmsrv = "LDAP://" & rs.fields("distinguishedName")
> 
>     set svsSmtpserver = getobject(strstmsrv)
>     wscript.echo "ServerName:" &
> mid(svsSmtpserver.distinguishedName,instr(svsSmtpserver.distinguishedName,"C
> N=Protocols,")+16,instr(svsSmtpserver.distinguishedName,",CN=Servers")-
> (instr(svsSmtpserver.distinguishedName,"CN=Protocols,")+16))
>     wscript.echo "Virtual Server Name:" & svsSmtpserver.adminDisplayName
>     wscript.echo "Max Message Size Limit:" &
> svsSmtpserver.msExchSmtpMaxMessageSize/1024 & " KB"
>     wscript.echo "IP:" & svsSmtpserver.msExchServerBindings
>     wscript.echo
>     rs.movenext
> wend
> 
> ****************************************************************************
> ****************************************************************************
> **
> 
>
date: Wed, 05 Oct 2005 09:13:34 -0400   author:   Joe Richards [MVP]

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us