We wish tho acquire the current loggedin user. We are using the following piace of code : -
use Win32:

LE qw( in );
my $self = [];
$self->[DOMAIN] = Win32:

omainName;
print $fhandle1 "\n domain : $self->[DOMAIN]\n";
# get ADO object, set the provider, open the connection
my $c = Win32:

LE->new("ADODB.Connection");
$c->{Provider} = "ADsDSOObject";
$c->Open("ADSI Provider");
print $fhandle1 "\n domain : $c\n";
die Win32:

LE->LastError() if Win32:

LE->LastError();
# prepare and then execute the query
my $ADsPath = "LDAP://cn=Users,dc=$self->[DOMAIN],dc=cms";
print $fhandle1 "\n ads is : $ADsPath\n";
my $rs = $c->Execute("<$ADsPath>;(& (samAccountName=cms*)(objectClass=User));Name,samAccountName,displayName;SubTree");
die Win32:

LE->LastError() if Win32:

LE->LastError();
print $fhandle1 "\n rs is : $rs \n";
#
## the execution stops at the secondlast line (die Win32::...)