QC20N
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:
but I get this error:
'Could not convert variant of type (Dispatch) into type (Boolean)'
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;
but I get this error:
'Could not convert variant of type (Dispatch) into type (Boolean)'
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. :)
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. :)
check this link to see how to convert AD lastLogonTimestamp to regular DataTime
http://translate.google.com/translate?hl=en&sl=da&u=http://omgili.com/thread/jHIAmI4hxg_WMxJVFh8OYr2BMWoOUo7gz.pN8U0ZSHaiWVIkmL3uRlt2OuoipPqN/&prev=/search%3Fq%3DADOQuery4.SQL.Text%2B:%253D%2B%2B%2522lastLogonTimestamp%2522%26biw%3D1536%26bih%3D768
http://translate.google.com/translate?hl=en&sl=da&u=http://omgili.com/thread/jHIAmI4hxg_WMxJVFh8OYr2BMWoOUo7gz.pN8U0ZSHaiWVIkmL3uRlt2OuoipPqN/&prev=/search%3Fq%3DADOQuery4.SQL.Text%2B:%253D%2B%2B%2522lastLogonTimestamp%2522%26biw%3D1536%26bih%3D768
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
How to convert date/time attributes in Active Directory to standard time format
http://support.microsoft.com/kb/555936
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Btw, are you from Denmark?
ASKER
I had ask the question before. Forgot I had it myself.
Active Directory LastLogon attribute