Determine timestamp for last login onto terminal server (2003)

active-directorywindows-server-2003windows-terminal-services

I am migrating a server and need a list of the last time users logged in, since just getting whos logged in currently won't help as its a remote terminal server and not everyone is logged in at the same time especially with a global company. I understand I can make a script on the login.bat but that will take time to populate over time. Is there any easy way to do this from AD or command line?

Since AD is used for all servers, I am only interested in last logged in for one particular server.

Thank you

Best Answer

Why not PowerShell? Something like this should get you started:

Get-EventLog -LogName Security -Newest 1000 | Where-Object {$_.EventID -eq 4624 -or 4634 } | ForEach-Object { $_.Message -split '\n' } | Select-String "Account Name"


You'll need your Audit Policy set appropriately so Windows will log the events in the first place (why this isn't a default setting is beyond me). Additionally you will want to use different EventIDs (528 and 540) for Windows Server 2003.

Related Topic