I was just investigating how to access Active Directory last week...I found the following link which had a perl example. http://www.perl.com/pub/a/2001/12/19/xmlrpc.html
It was more elaborate than I need, because I don't need to have a client piece and a daemon piece as I'm on windows. However, I was able to cut and paste code from the daemon and the client to form a working script. It does hinge on knowing your path as Steven indicated. I certainly don't claim to understand the guts of it though, I haven't had time to look at it fully. It is attached for your convenience. HTH, Paula -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Steven Manross Sent: Wednesday, October 02, 2002 1:37 PM To: 'Norris, Joseph'; Perl Win32 Users (E-mail) Subject: RE: Active directory madness - where is the phone number and the emai l It's not available using the WinNT provider.. The WinNT provider just has attributes that were commonly available via Lan Manager (and some more, but not telephone or e-mail). You must use the LDAP Provider.. And for that you must know the exact location of the user or use ADODB to find the actual path of the user you want to look at. Ex. LDAP://SERVER/cn=smanross,cn=Users,dc=domain,dc=com Grab a copy of the ADSI 2.5 SDK (from http://www.microsoft/downloads ) and start using ADSVW.EXE to see what is actually in the LDAP and WinNT Providers so you don't grow bald before your time. :( If you need a perl example of an ADODB search, look at Win32::Exchange's function _AdodbSearch or _AdodbExtendedSearch (I am sure there are better examples, but I know where this one is). You can get Win32-Exchange from CPAN or, ppm install Win32-Exchange --location=http://www.roth.net/perl/packages Steven -----Original Message----- From: Norris, Joseph [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 02, 2002 11:02 AM To: Perl Win32 Users (E-mail); Perl Admin (E-mail) Subject: Active directory madness - where is the phone number and the emai l I have been using the Q&D code hack below to look inside active directory. I can not get to the telephone or email address for the user. I can not get any of the MandatoryProperties either. Any help would be appreciated. Thanks. the code: use Win32; use Win32::OLE qw( in ); use Win32::OLE::Const 'Active DS Type Library'; use Data::Dumper; my $user_name = $ARGV[0]; my $ADspath = "WinNT://" . Win32::DomainName() . '/' . $user_name; print $ADspath . "\n"; my $user = Win32::OLE->GetObject( $ADspath ); $user->GetInfo; print "full name: " . $user->{Fullname}."\n"; print "path: " . $user->{ADsPath}."\n"; print "schema: " . $user->{schema}."\n"; pritn "Phone: " . $user->{telephoneNumber} . "\n"; pritn "email: " . $user->{Email} . "\n"; my $userschema=Win32::OLE->GetObject($user->{schema}); print Win32::OLE::LastError."\n"; print "\n********** Mandatory Properties of $user: ***************\n\n"; foreach my $i (@{$userschema->{MandatoryProperties}}) { print "$i:\t".$userschema->Get($i)."\n"; } print "\n********** Optional Properties of $user->{Fullname}: *****************\n\n"; foreach my $i (@{$userschema->{OptionalProperties}}) { print "$i:\t".$user->Get($i)."\n"; } _______________________________________________ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
ActiveDir2.pl
Description: ActiveDir2.pl