Also you could enable auditing and audit log on/log off.
Main Topics
Browse All TopicsI would like to track what time a user logs off and on each day. Is there an easy way to do this on a Windows 2000 domain?
Thanks in advance!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: sk08Posted on 2004-03-16 at 15:56:51ID: 10611351
You can write a log off script to solve this problem
ileSystemO bject"); txt", 8, true); );
ileSystemO bject"); txt", 8, true); );
icy\User\S cripts
It would not work if the user forced shutdown by pressing the power button. But otherwise, if user logs on or off you can run the particular script.
You can use Windows Scripting Host to write the logon /logoff script.
To make it easier for you, here is the script written in Microsoft JScript.
Save it as .js file. Assuming that you have wscript installed in your machine (by default it is there in every windows machine)
/*****************
Logon Audit
logon.js
*****************/
var wNetwork = WScript.CreateObject ("WScript.Network");
var fso = new ActiveXObject("Scripting.F
var out = fso.OpenTextFile("c:\\log.
out.WriteLine("Logged on at "+(new Date()+"").substring(0, 19)+"\t"+wNetwork.UserName
out.Close();
/*****************
Logoff Audit
logoff.js
*****************/
var wNetwork = WScript.CreateObject ("WScript.Network");
var fso = new ActiveXObject("Scripting.F
var out = fso.OpenTextFile("c:\\log.
out.WriteLine("Logged off at "+(new Date()+"").substring(0, 19)+"\t"+wNetwork.UserName
out.Close();
The scripts will write username and date in the log.txt file in C drive.
When you have these 2 files, save them somewhere in your computer.
Ideal location would be
c:\winnt\system32\GroupPol
Put logon.js in folder called logon
and logoff.js in folder called logoff
These folders are inside the scripts folder.
GroupPolicy folder is hidden
Now click start button in the desktop, click Run...
In the run dialog, type gpedit.msc
It will open Group Policy Editor.
While you are there, under the User Configuration branch -> Go to Windows Settings subbranch -> Then Scripts (Logon/Logoff)
On the right hand side of the window separated by split bar, you will see logon and logoff
Click them one by one.
There will be a script choose dialog coming up for both.
Click add button in the dialog that opens. There will be two textboxes,
In the top one, type wscript and in the second box which takes parameters put the script name (logon.js for logon script).
Do the same for Logoff by choosing logoff.js for parameter.
Sometimes, you don't want user to see error if something goes wrong with your script (due to file permissions and other things), put /b option before the script name in the parameter box to run it silently.
Finally make sure, you give write access to your users for the logfile you are using.
In the script above, I have used log.txt in C:\ for both logon and logoff messages.