|
|
|
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]
|
|