Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Newbie, AD problem

by bingos (Vicar)
on May 26, 2011 at 10:10 UTC ( #906789=note: print w/ replies, xml ) Need Help??


in reply to Newbie, AD problem

lastLogon is stored as a large integer that represents the number of 100 nanosecond intervals since January 1, 1601 (UTC). A value of zero means that the last logon time is unknown.

I use an incantation like follows to get date type values out of AD:

sub msqtime2perl { # MicroSoft QuadTime to Perl my $foo = shift; my ($high,$low) = map { $foo->{ $_ } } qw(HighPart LowPart); return unless $high and $low; return ((unpack("L",pack("L",$low)) + unpack("L",pack("L",$high)) * (2 ** 32))) / 10000000) - 11644473600; } if ( $userObject->{lastLogon} and $userObject->{lastLogon}->{HighPart} + ) { $epochtime = msqtime2perl( $userObject->{lastLogon} ); }


Comment on Re: Newbie, AD problem
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://906789]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (12)
As of 2015-07-07 22:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls