Tim Johnson wrote:

> I'm having trouble getting the lastLogon property of a user in AD using
> Perl and LDAP.  Below is my code.  The problem is that I keep getting a
> blessed Win32::OLE hash returned instead of a number when returning the
> value of lastLogon.

This is the first issue, and it looks [below] like you have solved it.  If
you get anobject reference as return data, the best thing to do is eplore
it.

> The "hash" has no keys, so I think this might be a
> mismapping of the data type, but I'm not sure.

It sounds, since you do get an object in return, like the problem is in the
creation of the object.  One thing I noticed is that you use an identifier
including spaces, without quoting it:
my $ADUser = Win32::OLE->GetObject("LDAP://$dc/OU=Groups and
Users,OU=HQ,DC=domain,DC=com") || die;
I'm not familiar with AD specifically, but in Windows in general, such long
identifiers do need to be quoted.  It could be that that particular module
doesn't require internal quoting; that it just looks for the next parameter
name, but it might be worth trying:
my $ADUser = Win32::OLE->GetObject("LDAP://$dc/OU=\"Groups and
Users\",OU=HQ,DC=domain,DC=com") || die;

I'm also wondering about having multiple OUs [Groups and Users, HQ] in the
constructor.  Is the constructor designed for that?

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to