Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Record User Logon/Logoff Activity in AD

Posted on 2013-12-23
Medium Priority
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
Office 365 Training for IT Pros

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.


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 2000 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

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

This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
How to deal with a specific error when using the Enable-RemoteMailbox cmdlet to create a mailbox in the cloud-based service, for an existing user in an on-premises Active Directory.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

715 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