http://aspn.activestate.com/ASPN/docs/ActivePython/2.4/pywin32/html/com/help
/active_directory.html

 

Time in active directory is stored in a 64 bit integer that keeps track of
the number of 100-nanosecond intervals which have passed since January 1,
1601. The 64-bit value uses 2 32 bit parts to store the time. The following
is a function that returns the time in the typical format the python time
libraries use (seconds since 1970). Here's an example where you'd use it:
user=opends('fred') print 'time in
seconds',conv_time(user.pwdLastSet.lowpart,user.pwdLastSet.highpart)
user.pwdLastSet returns a com object, not a python data type. 

def conv_time(l,h):

    #converts 64-bit integer specifying the number of 100-nanosecond

    #intervals which have passed since January 1, 1601.

    #This 64-bit value is split into the

    #two 32 bits  stored in the structure.

    d=116444736000000000L #diference between 1601 and 1970

    #we divide by 10million to convert to seconds

    return (((long(h)<< 32) + long(l))-d)/10000000    

 

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 08, 2008 8:46 AM
To: Active Directory Admin Issues
Subject: RE: Last Logon Date of AD users

 

Naresh, I received the same information when I ran a script similar to what
you have. However, I am assuming the output with 1/1/1601 is an indication
that they have not logged on to the network. The accounts with the date of
1/1/1601 where alias accounts and accounts we created that have not logged
onto the network.

 

Maybe someone else can provide additional information as to why the date is
populated with 1/1/1601.

 

 

Thomas

 

From: Naresh Kumar [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 08, 2008 2:20 AM
To: Active Directory Admin Issues
Subject: Last Logon Date of AD users

 

Hello Everybody,

 

I am badly in need of help. I need to retrive the last logon date for
specified members. I googled for that and got the below lines from microsoft

 

On Error Resume Next
Set objUser = GetObject("LDAP://cn=Ken Myer, ou=Finance, dc=fabrikam,
dc=com")
Set objLastLogon = objUser.Get("lastLogonTimestamp")

intLastLogonTime = objLastLogon.HighPart * (2^32) + objLastLogon.LowPart 
intLastLogonTime = intLastLogonTime / (60 * 10000000)
intLastLogonTime = intLastLogonTime / 1440

Wscript.Echo "Last logon time: " & intLastLogonTime + #1/1/1601#

 

I had made changes to the second line according to my OU structure and got
the output : Last logon time: 1/1/1601

 

Can anyone please help me on this.

 

Thanks in advance

 

Naresh

~ NEW: CounterSpy Enterprise: Centralized Antispyware - #1 in eWEEK Test! ~
    ~    ~

This email and any attached files are confidential and intended solely for
the intended recipient(s). If you are not the named recipient you should not
read, distribute, copy or alter this email. Any views or opinions expressed
in this email are those of the author and do not represent those of the Girl
Scouts of Southwest Texas. Warning: Although precautions have been taken to
make sure no viruses are present in this email, Girl Scouts of Southwest
Texas cannot accept responsibility for any loss or damage that arise from
the use of this email or attachments.

 

~ NEW: CounterSpy Enterprise: Centralized Antispyware - #1 in eWEEK Test! ~
    ~    ~

~ NEW: CounterSpy Enterprise: Centralized Antispyware - #1 in eWEEK Test! ~
    ~  <http://www.sunbelt-software.com/product.cfm?id=400>  ~

Reply via email to