?
Solved

Atrribute in AD is has a Datatype = largeinteger

Posted on 2014-01-15
7
Medium Priority
?
322 Views
Last Modified: 2014-02-08
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)'
0
Comment
Question by:QC20N
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 19

Expert Comment

by:Thommy
ID: 39781716
This previous EE question should help you...
Active Directory LastLogon attribute
0
 

Author Comment

by:QC20N
ID: 39781743
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. :)
0
 
LVL 43

Expert Comment

by:Eugene Z
ID: 39781849
0
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 
LVL 43

Expert Comment

by:Eugene Z
ID: 39781861
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
0
 

Accepted Solution

by:
QC20N earned 0 total points
ID: 39781879
Hi EugeneZ.

I just found out that I already have the solution in my list of questions.

Sorry for the trouble.

I will delete the question.

http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_27231873.html
0
 

Author Comment

by:QC20N
ID: 39781895
Btw, are you from Denmark?
0
 

Author Closing Comment

by:QC20N
ID: 39843938
I had ask the question before. Forgot I had it myself.
0

Featured Post

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Let's recap what we learned from yesterday's Skyport Systems webinar.
Viewers will learn how the fundamental information of how to create a table.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question