creating Exchange mailBox via Ruby?

T

tech.samaritan

Howdy!

I am setting up services that automagically provision a new portal user
with things like filespace, and an Exchange mailbox. The filespace is
easy, but I have not found any way to do the Exchange part. I have
many vbscript examples, but that does not help me any if ruby cannot do
what vbs can. So the question is:

Can Ruby interact with Exchange Information Stores, by creating
mailboxes, changing mailbox properties and the like?

The vbs examples look like they use LDAP to connect and interact, but
the methods that are used seem to be specific to vbs. Any one with any
experience with this?

PS. I know that I can use vbs, but our setup would require the scripts
to be run on a DC, and I would like to avoid that type of dependance.
 
T

tech.samaritan

I am looking into ADSI now... wondering if I can do almost the exact
same stuff in ruby as what I found in vbs...
 
T

Tanner Burson

------=_Part_20067_1426743.1134071785457
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Howdy!

I am setting up services that automagically provision a new portal user
with things like filespace, and an Exchange mailbox. The filespace is
easy, but I have not found any way to do the Exchange part. I have
many vbscript examples, but that does not help me any if ruby cannot do
what vbs can. So the question is:

Can Ruby interact with Exchange Information Stores, by creating
mailboxes, changing mailbox properties and the like?

The vbs examples look like they use LDAP to connect and interact, but
the methods that are used seem to be specific to vbs. Any one with any
experience with this?

PS. I know that I can use vbs, but our setup would require the scripts
to be run on a DC, and I would like to avoid that type of dependance.


Sure it can. Check out the Win32OLE library. It allows you to make all of
the same calls you would in VBScript, in Ruby. I don't have a link off
hand, but if you used the ruby installer for win32 you've already got it.




--
=3D=3D=3DTanner Burson=3D=3D=3D
(e-mail address removed)
http://tannerburson.com <---Might even work one day...

------=_Part_20067_1426743.1134071785457--
 
T

tech.samaritan

I have found that I can do all the normal stuff, but interaction with
exchange is via CDOEXM.DLL, and I still have to see if WIn32OLE will do
that part as well. I can return all the user properties, and even the
HomeMDB which is the full path to the user's mailbox, but I have not
had any success with CreateMailbox. I am thinking that I may have to
do it on the server for it to have access to the right DLL.
 
T

Tanner Burson

------=_Part_6003_26279534.1134150733369
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

I have found that I can do all the normal stuff, but interaction with
exchange is via CDOEXM.DLL, and I still have to see if WIn32OLE will do
that part as well. I can return all the user properties, and even the
HomeMDB which is the full path to the user's mailbox, but I have not
had any success with CreateMailbox. I am thinking that I may have to
do it on the server for it to have access to the right DLL.


Really the only difference between performing this task in Ruby versus doin=
g
it in VBScript is that you get to use Ruby :) Otherwise the same
restrictions still apply. The COM Objects still have to reside locally
unless you're doing some DCOM mojo. To my knowledge though CDO has to be
installed locally, but that doesn't mean it has to be run from the Exchange
server. I've seen automated Exchange creation run via a VBScript on a
member server in the domain, as opposed to directly on the Exchange box.
You just need to make sure you get CDO and all of that installed on the box
you want to do the creation from.




--
=3D=3D=3DTanner Burson=3D=3D=3D
(e-mail address removed)
http://tannerburson.com <---Might even work one day...

------=_Part_6003_26279534.1134150733369--
 
T

tech.samaritan

I have the Exchange Management Tools installed, and I can do a little
more than before. I can query and set attributes, but I cannot
actually create a mailbox or set store defaults on existing mail boxws.
It tells me it is an invalid method in both cases.

Here is the bit of code:

usr =WIN32OLE.connect("LDAP://CN=" + @login + cont)
usr.CreateMailbox("LDAP://" + mBox )
usr.EnableStoreDefaults = TRUE
usr.AccountDisabled = FALSE
usr.SetInfo
usr.put "protocolsettings" , "POP3§0§1§4§ISO-8859-1§0§§§"
usr.setinfo

I would really love to be able to do this in Ruby, since cscript takes
so land to start it adds 10+ seconds to the operation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top