Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Last logon date ? 2

Status
Not open for further replies.

rswift

Technical User
Oct 14, 2002
55
US
In an NT 4.0 environment is there any way to see how long it's been since a user last logged on?
 
One way is with the [tt]net[/tt] command with the [tt]user[/tt] option. Other people may come up with other ideas.

Use [tt]net user /?[/tt] to get the full syntax, but there are two basic options.

If it's a local account, run the command on the NT server (or workstation) using just the [tt]user[/tt] option:
[tt] net user rswift[/tt]

If it's a domain account, run the command from any NT machine in the domain but use the [tt]user /dom[/tt] option:
[tt] net user /dom rwsift[/tt]

Either way, it should output the last logon date (along with full name, group memberships, logon script name etc). You could always | (pipe) the output through a [tt]find[/tt] command to just get the last logon line.
 
I have a combination Command file/VB script that generates what you need and more. In my command file I use the USRSTAT command from the resource kit and pipe it to a data file, I then parse this file in the script and write everything I need to an excel spreadsheet. The information I gather is the User ID, User Name, Home Folder name, Home Folder Size, Last Login Date from the PDC and all the BDC's then take the newest date and put that in a seperate column. I also check if the account is Active/Disabled then display this as well. I recently changed the script to highlight Disabled accounts and any account that has not logged in in the past 90 days. Let me know if you want a copy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top