Link to home
Start Free TrialLog in
Avatar of QC20N
QC20NFlag for Denmark

asked on

Atrribute in AD is has a Datatype = largeinteger

Hi experts.

I'm trying to get the atrribute "lastLogonTimestamp" and it is a date from activedirectory by using SQL syntax. The date is a largeinteger datatype.

I do not know how to get the data from AD into something useful.

I have tried to do this:

var
bigint : int64

begin
  try
    ADOQuery4.SQL.Clear;
    ADOQuery4.SQL.Text := 'SELECT operatingSystem, lastLogonTimestamp FROM '+ Quotedstr('LDAP://OU=COMPUTERS,OU='+copy(ComputerNavn,3,2)+',OU='+copy(ComputerNavn,1,2)+',OU=FIRM,DC=AD,DC=FIRM,DC=ORG') + ' WHERE cn = '+ QuotedStr(ComputerNavn);
    ADOQuery4.Open;
    bigint := ADOQuery4.FieldByName('lastLogonTimestamp').AsLargeInt;
  finally
    ADOQuery4.Close;
  end;
end;

Open in new window


but I get this error:


'Could not convert variant of type (Dispatch) into type (Boolean)'
Avatar of Thommy
Thommy
Flag of Germany image

This previous EE question should help you...
Active Directory LastLogon attribute
Avatar of QC20N

ASKER

Funny that I could not find that myself, but thank you for the link.

But as it is now, I have already some SQL calls to Active Directory. I would like to keep it that way. I do not like to mix things. I do not hope that will be any problem. :)
you may like to use w32tm.exe /ntte

How to convert date/time attributes in Active Directory to standard time format
http://support.microsoft.com/kb/555936
ASKER CERTIFIED SOLUTION
Avatar of QC20N
QC20N
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of QC20N

ASKER

Btw, are you from Denmark?
Avatar of QC20N

ASKER

I had ask the question before. Forgot I had it myself.