Hello,

It has been six years since I have shifted into a new role from being
a systems administrator to being an IT auditor. It's been a while
since I've written my last perl script.


Now I'm back here again to get some help. Basically my job now
requires me to conduct audits on the information stored in our active
directory.
I've done some reading and learned that in order to automate that
particular task using perl, I would have to use either Win32::OLE or
Net::LDAP. So I decided to use to former. Now I am confronted with
this simple problem which one would consider the biggest hurdle that a
beginner programmer has to overcome for the first time. This is like
the hello world program for me. If I can get past this, I know I can
do anything.

The problem with the code below is that it is not able to retrieve the
object if I type in my DN. If it's just the container OUs, then it
seems to work fine. Let's say I would put
"OU=CODP,OU=Users,OU=MLAPH,OU=AsiaPacific,OU=MLAROOT,DC=int,DC=mlaph,DC=com"
instead, it would work just fine.

It doesn't work when I specify a user's distinguished name.

Unfortunately for me, I'm still looking for reference materials to
help me with ADSI/COM programming in perl because the documentation
for Win32::OLE doesn't really say much to help me going. Is there
anything here you can recommend?



#!/usr/bin/perl

use 5.010;
use strict;
use warnings;
use Win32::OLE;

my $userObject = Win32::OLE->GetObject("LDAP://CN=Sison\,
Andrew,OU=CODP,OU=Users,OU=MLAPH,OU=AsiaPacific,OU=MLAROOT,DC=int,DC=mlaph,DC=com")
or die "Unable to retrieve object", "\n";

print $userObject->{displayName}, "\n";

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to