Record User Logon/Logoff Activity in AD

Posted on 2013-12-23
Last Modified: 2014-03-06

I would like to monitor user login activity including when the user simply locks a workstation.

I downloaded Microsoft Log Parser, but for some it does not work against the Security log on the domain controller. The Parser, however, works against the System log on the same controller. Any ideas?

Any other solutions to monitor and audit the user activity?

Thank you.
Question by:exhuser
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
  • 7
  • 6
LVL 29

Expert Comment

ID: 39737148
What operating system specifically are your clients using ?

If win7 or greater:

Parse for the following event IDs
4800 The workstation was locked.
4801 The workstation was unlocked.

If auditing is not enabled you will not see the above entries so verify login event auditing is enabled as shown below.
secpol.msc  local policies - audit policy - you can select the events you want to audit there.

Audit Other Logon/Logoff Events

Author Comment

ID: 39737152
I am using Windows XP and Windows 7.

Would you have the exact syntax for the command?

LVL 24

Expert Comment

ID: 39740127
There is no direct way to check the same if auditing is enabled you can check the DC event log to track the same.

Instead of checking the eventvwr with too much info to look through you can use a simple logon/logoff script which outputs logon info to a text file.

How to track users logon/logoff

If the account is getting locked then On th DC check the security log event id 644(Win2003) or 4740(Win2k8) will occur if the account is getting locked.Open the event and check the caller Machine.If you check the multiple 644 logs you will find the same caller machine.If this is the case unplug the caller machine from the network and do windows patching on the PC and update the virus defination and do full scan.There could be multiple PC in the environment which may be affected by Conficker virus.

Note:If the event id 644 has not occured then this mean that in audit policy user account management policy is not configured.Configure the same and check if the events are occuring.This scenario is for only Conficker Virus as I have faced the same issue in my network.

There may be many other causes for account locked out.
•user's account in stored user name and passwords
•user's account tied to persistent mapped drive
•user's account as a service account
•user's account used as an IIS application pool identity
•user's account tied to a scheduled task
•un-suspending a virtual machine after a user's pw as changed

For more refer KB article:

Troubleshooting account lockout the Microsoft PSS way:

Paul Bergson's User Account Lockout Troubleshooting

Download the accountlockout tools and management pack to help resolve the issue.

Auditing failed logon events and account lockouts

You can also set the debug flag on NetLogon to track authentication.  "This creates a text file on the PDC that can be examined to determine which clients are generating the bad password attempts."
Enabling debug logging for the Net Logon service

Using the checked Netlogon.dll to track account lockouts
Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.


Author Comment

ID: 39740370
Has anybody used Microsoft Log Parse 2.2 for this?

 I am trying to see why it would not work against domain controller\Security option, where I can run the same (or similar) query against domain controller\System?

LVL 29

Expert Comment

ID: 39740460
Ok so here is an example and a link to help you better understand.
logparser "select EventID, TimeWritten, Message from security where
   (EventID  = 675 and EXTRACT_TOKEN(Strings,4,'|')='0x18') or
   (EventID = 681 and EXTRACT_TOKEN(Strings,3,'|')='0xC000006A')
   order by EventID, TimeWritten"

you can simply run this against the DC.

Here is an old article on using it:

A primer on logparser:

A good third party solution:

Author Comment

ID: 39742937
Again, I am getting "WARNING: Input format not specified - using TEXTLINE input format.
Error: WHERE clause: Syntax Error: unknown field 'eventid' with Security events

However, when I run the same against System events it works....
LVL 29

Expert Comment

ID: 39743647
It might be a matter of syntax, here is a very clear example:

The ones on the left are pre-win7 / vista (e.g XP)
Here is a list of the event IDs
512 / 4608  STARTUP
513 / 4609  SHUTDOWN
528 / 4624  LOGON
538 / 4634  LOGOFF
551 / 4647  BEGIN_LOGOFF

Author Comment

ID: 39755365
Again, it works if I type this command:
logparser -o:csv "select * into c:\temp\my
test.csv from \\DC1\system where eventid='XXX'"

However, when
logparser -o:csv "select * into c:\temp\my
test.csv from \\DC1\security where eventid='YYY'"

And the events XXX and YYY events are in the event logs
LVL 29

Accepted Solution

becraig earned 500 total points
ID: 39810927
Are you running logparser as Administrator ?

In order to query security logs you MUST run it as Administrator

Author Comment

ID: 39819008
I am a member of Domain Admin group.
LVL 29

Expert Comment

ID: 39860659
If you are running this as administrator and still having issues I'm not sure what might be the issue here.

I would try right clicking the window and run as administrator and see if we get the same error.

By default, an ordinary user does not have permission to read the security log
(This seems to be an issue of permissions since it works for system logs)

Author Comment

ID: 39907766
This isshue is still not resolved
LVL 29

Expert Comment

ID: 39907784
Can you tell me if this works for you:

You have to run from a powershell window.

 Get-WinEvent -LogName security -computername  servename

If that does I can whip something together so you can query for the events that track logon and logoff.

Author Closing Comment

ID: 39910833
I guess this was the problem, even though I am a member of Domain Admins group.

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Suggested Courses

617 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