#85796 - 2002-05-29 10:52 PM
ADSI-Exchange Query Mailbox Info
|
Chris S.
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
|
|
|
|
#85798 - 2002-05-30 06:27 AM
Re: ADSI-Exchange Query Mailbox Info
|
Howard Bullock
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.
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 ]
|
|
Top
|
|
|
|
#85800 - 2002-05-31 12:53 AM
Re: ADSI-Exchange Query Mailbox Info
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
|
|
Top
|
|
|
|
#85802 - 2002-05-31 12:18 AM
Re: ADSI-Exchange Query Mailbox Info
|
Anonymous
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
|
|
|
|
#85806 - 2002-05-31 03:48 AM
Re: ADSI-Exchange Query Mailbox Info
|
NTDOC
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.
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
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Les, I knew that. 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.
|
|
Top
|
|
|
|
#85808 - 2002-05-31 02:35 PM
Re: ADSI-Exchange Query Mailbox Info
|
Chris S.
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 ).
|
|
Top
|
|
|
|
#85809 - 2002-05-31 07:28 PM
Re: ADSI-Exchange Query Mailbox Info
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
NTDOC, any info on Exchange 2000?
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 1821 anonymous users online.
|
|
|