7/27/2001O'Reilly Open Source Convention1 Pushing the Envelope With Perl: Using Perl With Microsoft Exchange Rick Tatem Systems Programmer SAS
7/27/2001O'Reilly Open Source Convention2 About the speaker… Started in the UNIX world (’92-99) Perl user since ~ ’94 Moved into NT by choice (’96) Something new Not backups No Guru…
7/27/2001O'Reilly Open Source Convention3 Microsoft Exchange Exchange version 5.5 Information Store transactional database Private (mailboxes) and Public Directory Service LDAP compliant Separate from the accounts database
7/27/2001O'Reilly Open Source Convention4 Perl and Windows NT/2000 Windows/UNIX issues Binary distribution from ActiveState Key modules Win32::OLE Win32::OLE::Enum Perl Development Kit PerlCtrl – create COM objects Visual debugger Perl2exe
7/27/2001O'Reilly Open Source Convention5 Perl and Windows NT/2000 Most example code is VBScript Don’t reinvent the wheel Translation is easy
7/27/2001O'Reilly Open Source Convention6 Perl and Windows NT/2000 VB to Perl example All perl scripts begin with: use strict; use Win32::OLE; Methods vs. Properties Dot notation ADO Connection example Listing 1Listing 2
7/27/2001O'Reilly Open Source Convention7 Perl and Windows NT/2000 VB Set conn = CreateObject("ADODB.Connection") conn.Provider = "ADSDSOObject" conn.Open "ADsProvider;CN=uid,DC=domain;pwd" Perl my $conn = Win32::OLE->new("ADODB.Connection"); $conn->{'Provider'} = "ADsDSOObject"; $conn->Open("ADs Provider;CN=uid,DC=domain;pwd"); Listing 1Listing 2
7/27/2001O'Reilly Open Source Convention8 Exchange-related Tasks Message Tracking Information Stores Directory Services
7/27/2001O'Reilly Open Source Convention9 Message Tracking Logs Simple tab delimited text Exchange Admin GUI tool for following messages throughout site Usefulness (find source of virus outbreak)
7/27/2001O'Reilly Open Source Convention10 Message Tracking Logs Perl featured in Exchange Admin newsletter article (July, 2000) Good Used Perl Useful concept – overall message flow Not good for multiple-server Code Example
7/27/2001O'Reilly Open Source Convention11 Directory Services Most tools High visibility Even more important after transition to Active Directory Major projects Rules-based Distribution Lists DLManager
7/27/2001O'Reilly Open Source Convention12 Rules-based Distribution Lists Examples lacking Only creation shown No concept of ‘update’ Perl makes it easier Easy to compare lists Win32::OLE gives you access to ADSI
7/27/2001O'Reilly Open Source Convention13 Rules-based Distribution Lists Membership rules are in Perl syntax (($unit eq ‘DEPT’) && ($loc eq ‘City’)) For each list… Rule is eval’ed for each employee Current membership compared to eval’ed membership Adds/Deletes/Creates as necessary
7/27/2001O'Reilly Open Source Convention14 DLManager Requirements Decommission ListServ on VM Provide same functionality (80/20) 2/3 already done “Closed” lists – regular DLs Automated lists – autodl.pl “OPEN” lists – not available
7/27/2001O'Reilly Open Source Convention15 DLManager Available solutions lacking in one way or another Microsoft’s EXLIST Reddfish ListServer NTP ListManager
7/27/2001O'Reilly Open Source Convention16 DLManager Major features Actually USES the existing directory Leverages security Written in Perl PerlCtrl – part of Perl Development Kit from ActiveState
7/27/2001O'Reilly Open Source Convention17 DLManager Sample code Demo
7/27/2001O'Reilly Open Source Convention18 Exchange 2000/Active Directory MAJOR changes/improvements Directory NT Account (SAM)/Exchange Directory consolidation Distribution List = Security Group + mail Extensible Schema
7/27/2001O'Reilly Open Source Convention19 Exchange 2000/Active Directory Information Store IFS – ‘cd’ into your mailbox! WebDAV XML Store Events/Sinks Synchronous events More robust
7/27/2001O'Reilly Open Source Convention20 Conclusion Currently updating code for Windows2000 Active Directory and Exchange2000 Code available from me PerlCtrl available as part of Perl Development Kit from ActiveState Q&A… Thank you!