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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.