Listing01_RootDSE (Perl)

This code can be found in Chapter 5 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

use Win32::OLE;
eval {
   $wmi_path = "winmgmts://dc1/root/directory/LDAP:RootDSE=@";
   $rootDSE = Win32::OLE->GetObject($wmi_path)
      or die "Could not get RootDSE\n";
   print "dnsHostname:          $rootDSE->{dnsHostName}\n";
   print "defaultNamingContext: $rootDSE->{defaultNamingContext}\n";
};
if ($@) {
   print "Error: $@\nOLE Error: ",Win32::OLE->LastError, "\n";
}

This code has been viewed 818 times.

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