Page 1 of 1 1
Topic Options
#85796 - 2002-05-29 10:52 PM ADSI-Exchange Query Mailbox Info
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
This post is a result of me going off on a tangent. Howard replied to a post in which he provided a link to his Perl utilities page. He has a spiffy little utility to query Exchange mailboxes and it made me wonder if I could do it with ADSI. When I searched this BB for ADSI and Exchange, I didn't find much so I did my own research. Here's what I came up with:

code:
break on cls
$=execute(ListMailboxInfoByUser("$user"))

function ListMailboxInfoByUser($user)
$mailbox=getobject("LDAP://oh01ex01/cn=$user,cn=Recipients,ou=World HQ,o=Relizon")
? "Mailbox Information for $user:" ?
? "User Information:"
? " Display Name: " $mailbox.get("cn")
? " Given Name: " $mailbox.get("givenname")
? " Last Name: " $mailbox.get("sn")
? " Alias: " $mailbox.get("uid")
? "Mailbox Information:"
? " Primary SMTP: " $mailbox.get("mail")
? " X.400 Address: " $mailbox.get("textencodedoraddress")
? " Home MTA: " $mailbox.get("home-mta")
? " Home MDA: " $mailbox.get("home-mda")

? "Other Mailboxes:"
$array=$mailbox.get("othermailbox")
for each $item in $array
$oname=substr($item,1,instr($item,"$$")-1)
$oaddress=substr($item,len($oname)+2,len($item))
? " " $oname ": "$oaddress
next
endfunction

The output is as follows:

code:
Mailbox Information for ShiltCK:

User Information:
Display Name: Shilt, Christopher K
Given Name: Christopher
Last Name: Shilt
Alias: Christopher.Shilt
Mailbox Information:
Primary SMTP: Christopher.Shilt@Relizon.com
X.400 Address: c=US;a= ;p=Relizon;o=WorldHQ;s=Shilt;g=Christopher;i=K;
Home MTA: cn=Microsoft MTA,cn=OH01EX03,cn=Servers,cn=Configuration,ou=World HQ,o=Relizon
Home MDA:
Other Mailboxes:
X500: /o=Relizon/ou=World HQ/cn=Recipients/cn=ShiltCK
NOTES: Christopher K Shilt/World HQ/Relizon@Relizon
MS: RELIZON/WORLDHQ/CHRISTOPH3
CCMAIL: Shilt, Christopher at World HQ

I love to have some feedback/improvement on this. If you try it out, you'll naturally have to provide your own Exchange server, OU, O, etc. This was tested on Exchange 5.5. It should work on Exhcange 5.5 and earlier. M$ says it won't work on Exchange 6. Management and access to Exchange 6 should use the CDOEXM interfaces instead.

Top
#85797 - 2002-05-30 02:20 AM Re: ADSI-Exchange Query Mailbox Info
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Thanks Chris,

I was going to run it, but we have Exchange 2000 It comes back blank for me.

I'll see if I can use some other method in the coming week, if I get time.

Top
#85798 - 2002-05-30 06:27 AM Re: ADSI-Exchange Query Mailbox Info
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
You guys will get me to translate that Perl mailbox stuff to KixTart yet. [Smile] [Smile]

NTDOC, try my Perl program on Exchange 2000 and let me know if it fails. I'll have to fix that while I work on providing some Exchange support in KixTart.

[ 30 May 2002, 06:30: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#85799 - 2002-05-30 11:43 AM Re: ADSI-Exchange Query Mailbox Info
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Sorry, Where's the link Howard? I've seen before, but I'm feeling lazy after getting up at 07:00 for work, coming home to wire new remodeling job at home. It's now 02:45 and I was just checking in before going to bed.
Top
#85800 - 2002-05-31 12:53 AM Re: ADSI-Exchange Query Mailbox Info
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
http://mywebpages.comcast.net/habullock/Perlutilities.htm
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#85801 - 2002-05-30 08:30 PM Re: ADSI-Exchange Query Mailbox Info
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Thanks Howard,

I'm at home now, but when I get back to work tomorrow, I'll try and run it and let you know how it goes.

Top
#85802 - 2002-05-31 12:18 AM Re: ADSI-Exchange Query Mailbox Info
Anonymous
Unregistered


Two things I'm thinking of:

$=execute( should not be used. $rc=execute( would be a better choice, especially with KiXtart 4.02 and previous vesions. Ref: http://www.scriptlogic.com/Support/Forums/display_message.asp?mid=2525

Also, you reference $user in a couple places. Is this a dynavar defined elsewhere in your script?

-Brian

Top
#85803 - 2002-05-31 03:24 AM Re: ADSI-Exchange Query Mailbox Info
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Howard,
Please, it's KiXtart, not KixTart!
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#85804 - 2002-05-31 03:39 AM Re: ADSI-Exchange Query Mailbox Info
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Give 'em Hell Harry. Damn the torpedoes... Full steam ahead.
Top
#85805 - 2002-05-31 03:41 AM Re: ADSI-Exchange Query Mailbox Info
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Go ahead! Make my day! [Cool]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#85806 - 2002-05-31 03:48 AM Re: ADSI-Exchange Query Mailbox Info
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Your not a RCMP are you? Let's be putting down that baseball bat and step away from the counter.

Harry S. Trueman would be shocked. [Wink]

Care to let it off your chest tonight Les? roflmao

ps. Oh, thanks Les, my post just hit 1,200

[ 31 May 2002, 03:53: Message edited by: NTDOC ]

Top
#85807 - 2002-05-31 01:44 PM Re: ADSI-Exchange Query Mailbox Info
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Les, I knew that. [Embarrassed] I could make all kind of excuses since I'm on furlough and my wife's HoneyDo list seems to be without end, but...

It must have been a left brain right brain thing and the SHIFT key was pressed one character too late. Please don't tell Ruud that I still don't know the name of the product I used for years.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#85808 - 2002-05-31 02:35 PM Re: ADSI-Exchange Query Mailbox Info
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Brian,

Thanks for your input. I kind of posted the script in haste as I was getting ready to leave work. The $ vs. $rc is noted. I passed the value for $user in the command line to start the script. In that particular test script, I have a slew of ADSI functions/routines that I essentially keep stored in this test script so I don't lose the code as I "play around."

I did find a problem with my script, at least in our environment, in that the mailbox name isn't necessarily the user's username. My company was divested from our parent company and they initially used a different naming convention for naming mailboxes. When they first started creating mailboxes they were named: "givenname_surname." They are know created with the NT username as the mailbox name.

Thus, my script doesn't capture all of my user's mailbox info. I'm very interested in how Howard managed to grab all of the mailboxes associated with an NT account and if his Perl method is translatable to KiXtart (notice, Howard, that I got it right [Wink] ).

Top
#85809 - 2002-05-31 07:28 PM Re: ADSI-Exchange Query Mailbox Info
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
NTDOC, any info on Exchange 2000?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1782 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.654 seconds in which 0.33 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org