Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Programming Active Directory

posted by pudge on 2001.10.27 2:48   Printer-friendly
An anonymous user writes, "I just noticed an article with a couple of links about Perl and NetWare and being able (if I read it right) to manipulate the NDS. Is it possible to use Perl to manipulate the Windows 2000 Active Directory?"

Beats me.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • All of the Active Directory API is available to a script running unders Windows Scripting Host, including perl scripts. So yes, you can manipulate AD via perl, assuming your perl is running on a W2K box.
  • If you're running the scripts from Win32 platforms, you can use Win32::OLE to interface to AD. Check out Perl for System Administrators from O'Reilly. We do this all the time to create and query user accounts in AD.
    • Whilst currently I have no need to do this kind of thing - it would nonetheless be nice to see some kind of tutorial on this. Perhaps one of you guys could write an article for here or perl.com about how you would approach this.

      /J\
    • I have created a rudimentary perl module which allows user and group account management through ADSI. The ADSILDAP module has worked very well for the applications I have written. It is based on the NT user and group names as opposed to their LDAP distinguished names (although this functionality is also supported). The program is documented, with samples. Many of the concepts are derived from other perl programmers in the community, such as Steven Manross who wrote the Win32::Exchange module. Enough wi
  • Here's a sample to get you started:

    ---------------------
    use Win32::OLE;
    use strict;

    my $sysinfo = Win32::OLE->new('ADSystemInfo') || die ("Can't get sysinfo: ".Win32::OLE->LastError()."\n");

    my $username=$sysinfo->{UserName};
    print "Username:$username\n";

    my $adsuser = Win32::OLE->GetObject("LDAP://$username") || die ("Can't find user: ".Win32::OLE->LastError()."\n");
    print "CN: $adsuser->{cn}\n";
    print "Email address: $adsuser->{EmailAddress}\n";
    ---------------------

    This firs

  • http://www.cpan.org/authors/id/W/WI/WICKLINE/adsib rowser-20010222.plt

    This was some code I was monkeying with in an effort to grok ADSI a while back. It doesn't try to write anything, but just lets you nose around the directory structure via cgi. It's not pretty, but maybe you'd find it useful. The comments reference a couple of other resources I used when working on that stuff

    http://opensource.activestate.com/authors/tobyever ett/

    http://www.asptoday.com/articles/19990310.htm