Listing03_Shortcut_RootDSE_Net-LDAP (Perl)

This code can be found in Chapter 3 of Managing Enterprise Active Directory Services

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the Perl code from this site.

# --------------------------------------------------------------------
# From the book "Managing Enterprise Active Directory Services"
# ISBN: 0-672-32125-4
# Copyright (C) 2002 by Addison-Wesley
# Script by Robbie Allen
# 
# --------------------------------------------------------------------
$ldap = Net::LDAP->new('dc1.xyz.com')
    or die "Could not connect: $@";
$rootdse = $ldap->root_dse;
foreach $attr($rootdse->attributes) {
   foreach $value ($rootdse->get_value($attr)) {
      print "$attr: $value\n";
  }
}

This code has been viewed 732 times.

New from the creators of TechTasks.com: StatSheet.com