Example1 (Perl)
This code can be found in
Chapter 21 of Active Directory, 3rd Edition
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 "Active Directory, Third Edition"
# ISBN: 0-596-10173-2
use Win32::OLE;
use constant vbCrLf => "\r\n";
my $objUser;
# An ADSI User object
my $str;
# A text string
# User object using the WinNT namespace
$objUser = Win32::OLE->GetObject('WinNT://MYCORP/Administrator,User');
$str = 'Name: ' . $objUser->Name . vbCrLf;
$str = $str . 'GUID: ' . $objUser->GUID . vbCrLf;
$str = $str . 'Class: ' . $objUser->Class . vbCrLf;
$str = $str . 'ADsPath: ' . $objUser->ADsPath . vbCrLf;
$str = $str . 'Parent: ' . $objUser->Parent . vbCrLf;
$str = $str . 'Schema: ' . $objUser->Schema . vbCrLf . vbCrLf;
$objUser = undef;
# User object using the LDAP namespace
$objUser = Win32::OLE->GetObject('LDAP://cn=Administrator,cn=Users,dc=mycorp,dc=com');
$str = $str . 'Name: ' . $objUser->Name . vbCrLf;
$str = $str . 'GUID: ' . $objUser->GUID . vbCrLf;
$str = $str . 'Class: ' . $objUser->Class . vbCrLf;
$str = $str . 'ADsPath: ' . $objUser->ADsPath . vbCrLf;
$str = $str . 'Parent: ' . $objUser->Parent . vbCrLf;
$str = $str . 'Schema: ' . $objUser->Schema . vbCrLf . vbCrLf;
print "$str\n";
$objUser = undef;
|
This code has been viewed 1215 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|