Solved

Atrribute in AD is has a Datatype = largeinteger

Posted on 2014-01-15
7
293 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
  • 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 42

Expert Comment

by:EugeneZ
ID: 39781849
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 42

Expert Comment

by:EugeneZ
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now