Importing Active Directory users through Cron

Hello everyone, i installed the LDAPImport extension and it works fine,
however i only want to import users that have logged in at least once not
farther than 3 months ago.

So i am using the lastLogonTimestamp inside $LDAPFilter, the problem is that
i don’t know how to specify its value, i went to a page that offers a
calculator and started modifying the example so i had a date similar to what
i wanted, but i want to put a script in cron therefore the value in the
config can’t be static.

For the record, the value stored in that attribute represents the date and
time of the account logon, expressed in 100-nanosecond steps since 12:00 AM,
January 1, 1601.

Basically i need a script that subtracts 90 days from today’s date and
converts it to that format and can be referenced from

Some guru posted this in perlmonks:

print POSIX::strftime( “%Y-%m-%d”,
localtime(($lastLoginTime/10000000)-11644473600) );

But that snippet i think it’s for the opposite conversion, from the windows
format to a human readable one.

View this message in context:

I made this script, it isn’t 100% accurate but it’s good enough for my
purposes, $bigEpochTime->bstr returns the information i need. How do i call
this so the RT config can read its value?

use strict;
use warnings;
use Math::BigInt;

use constant BIGEPOCH => ‘116444736000000000’;

my $passwordPeriod=902460*60;
my $bigEpochTime = Math::BigInt->new(time() - $passwordPeriod);

#multiply by 10000000 to get 100 nanosecond intervals since epoch
print ($bigEpochTime->bstr);

View this message in context: