"Groups and Users" is the name of the OU in this case.  It turned out
later that my problem was that for some reason AD uses an 8-byte long
integer for the date, and it does have methods associated with it,
HighPart and LowPart, which aren't used in this case.  I think that's
why it was showing up as a hash. 

-----Original Message-----
From: R. Joseph Newton [mailto:[EMAIL PROTECTED] 
Sent: Saturday, November 22, 2003 1:26 PM
To: Tim Johnson
Cc: Beginners List
Subject: Re: OLE Hash problem getting AD lastLogon

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