[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: Interaction between OpenLDAP and MSExchange D.S.
- To: openldap-software@OpenLDAP.org
- Subject: Re: Interaction between OpenLDAP and MSExchange D.S.
- From: "Anthony E . Greene" <agreene@pobox.com>
- Date: Thu, 25 Jan 2001 02:46:15 -0500
- In-reply-to: <F183y7BXx4XFKpRcTCi00001929@hotmail.com>; from giovanni_ramirez@hotmail.com on Wed, Jan 24, 2001 at 12:18:54 -0500
- References: <F183y7BXx4XFKpRcTCi00001929@hotmail.com>
On Wed, 24 Jan 2001 12:18:54 Giovanni Ramirez wrote:
>I'm trynig to move my Directory and mail service from MS Exchange to
>OpenSource tools (like sendmail and openldap).
>
>The mail staff is almost done, but I want to migrate all the contents of
>the
>MSExchange Directory to the OpenLDAP directory. How can I make that?
Export the Exchange directory to a CSV file and use a perl script to convert
the CSV to LDIF. Attached is a script I used to convert a CSV to LDIF.
Tony
--
Anthony E. Greene <agreene@pobox.com> <http://www.pobox.com/~agreene/>
PGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26 C484 A42A 60DD 6C94 239D
Chat: AOL/Yahoo: TonyG05 ICQ: 91183266
Linux. The choice of a GNU Generation. <http://www.linux.org/>
#!/usr/bin/perl
#
# This is an example of using the Text::ParseWords module to convert
# a comma-delimited file to LDIF. Requires Perl 5.005 or higher. Just
# pipe the CSV file to this script and redirect the output to a file:
#
# cat FILENAME.csv | csv2ldif.pl > FILENAME.ldif
#
# Anthony Greene <agreene@pobox.com>
#
# Load the required module.
use Text::ParseWords;
# Set a default objectclass and suffix.
$objectlass = 'person';
$dnsuffix = 'dc=my organization, dc=com';
# Read lines from STDIN.
while ($line = <STDIN>) {
@fields = "ewords(',',0,$line);
# Set variable values based on the array values.
# Edit these to match the format of your CSV file.
$cn = $fields[0];
$fname = $fields[1];
$lname = $fields[2];
$title = $fields[3];
$o = $fields[4];
$ou = $fields[5];
$mail = $fields[6];
$phone = $fields[7];
$fax = $fields[8];
# Output the values.
print "dn: cn=$cn, $dnsuffix\n";
print "cn: $cn\n";
print "givenname: $fname\n";
print "sn: $lname\n";
print "title: $title\n";
print "o: $o\n";
print "ou: $ou\n";
print "mail $mail\n";
print "telephonenumber: $phone\n";
print "facsimileteletelephonenumber: $fax\n";
print "mail: $mail\n";
print "objectclass: $objectclass\n";
print "\n";
}
exit;