This discussion is archived
1 Reply Latest reply: Feb 10, 2012 10:43 PM by HakanBiroglu RSS

Regarding referencing attribute lastLogonTimestamp in peoplecode

user12167485 Newbie
Currently Being Moderated
Hi All,

Microsoft active directory stores attribute lastLogonTimestamp with data type microsoft OID. When we retrive this attribute using peoplecodewe get encrypted value. When I searched help for it on net I am getting below that can be execued thru visual basic.

objLastLogon = "129718586958613177"

intLastLogonTime = objLastLogon.HighPart * (2^32) + objLastLogon.LowPart

intLastLogonTime = intLastLogonTime / (60 * 10000000)

intLastLogonTime = intLastLogonTime / 1440


But this logic can be directly used in peoplesoft as peoplesoft does not support 64 bit variable. Please advise how we can extract data out of lastLogonTimestamp variable in active directory.
  • 1. Re: Regarding referencing attribute lastLogonTimestamp in peoplecode
    HakanBiroglu Oracle ACE
    Currently Being Moderated
    Did some search on the net and I found the java equivalent of the vb script at
    http://social.msdn.microsoft.com/forums/en-US/visualjsharpgeneral/thread/e0bbfaf0-e261-425e-b13f-b270fbc1de21/

    Whenever PeopleCode doesn't do the job, I find a solution in Java.
    Compile Java, add class to PS_HOME/classes dir, reboot appserver and call Java class from PeopleCode with buildin function CreateJavaObject()



    Java Sample :
    If you want to create a java date object out of this value, please try following this sample, where i have used an adjustment factor to convert the lastLogonTimestamp value into a Date object..

    import java.util.*;
    class Test
    {
    public static void main(String args[])
    {

    long llastLogonAdjust=11644473600000L; // adjust factor for converting it to java
    //date Epoch
    Date lastLogon = new Date(127877417297554938L/10000-llastLogonAdjust); //
    System.out.println(lastLogon);
    }
    }

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points