Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

2003 AD Domain , last logon time

Posted on 2013-01-18
5
Medium Priority
?
839 Views
Last Modified: 2013-01-27
Hey dudes, trying to find out the last known logon time for a user on the domain using the net user command but keep getting syntax errors. Anyone able to provide the correct syntax please?
0
Comment
Question by:Jason Thomas
  • 2
  • 2
5 Comments
 
LVL 35

Assisted Solution

by:Ernie Beek
Ernie Beek earned 300 total points
ID: 38792454
I don't think net user will give accurate results. There are other scripts to do that though: http://community.spiceworks.com/scripts/show/369-last-login-by-user
0
 
LVL 1

Author Comment

by:Jason Thomas
ID: 38792492
I will not be able to install the app on the end of that link and I cannot decipher the script, it appears to do a lot more than what I require.

Thanks anyway, anyone else got any ideas please?
0
 
LVL 35

Expert Comment

by:Ernie Beek
ID: 38792568
Well, this works for me:

net user anyuser /domain
The request will be processed at a domain controller for domain xxx.local.

User name                    anyuser
Full Name                    Beek, Ernie
Comment                      xxx
User's comment
Country code                 (null)
Account active               Yes
Account expires              Never

Password last set            8-10-2009 8:40:45
Password expires             Never
Password changeable          8-10-2009 8:40:45
Password required            Yes
User may change password     Yes

Workstations allowed         All
Logon script                 logon.bat
User profile
Home directory               \\xxx.local\etcetera
Last logon                   18-1-2013 12:40:18

Logon hours allowed          All

Local Group Memberships      lots
Global Group memberships     evenmore
The command completed successfully.

Open in new window


Keep in mind though that the "lastLogon" attribute is not replicated, a different value is
stored on each Domain Controller (DC) for each user or computer.
0
 
LVL 3

Accepted Solution

by:
jeorge earned 1200 total points
ID: 38792683
Hello!
i think it depends on what type of ad you are doing this.
if this is a 2003 then it's a bit difficult!
for each user you'll have to check on every DC for the lastlogontimestamp (if i recall correctly) and get the most recent entry. Why ? because this attribute is not replicated betweed DCs.

Read this thread

http://www.winserverkb.com/Uwe/Forum.aspx/windows-server-ad/19958/OldCMP-last-logon-timestamp-and-domain-controllers

or a VB scripts for
http://www.rlmueller.net/Last%20Logon.htm

Else if you want you can go for a third party freeware tool such as

http://www.lepide.com/last-logon-reporter.html

Hope it works for you.
0
 
LVL 1

Author Closing Comment

by:Jason Thomas
ID: 38824415
Thanks chaps.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
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…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

886 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