This is a quick script from my hands which logs the date and time of windows ‘loging’ and ‘logoff’.


dim objfso, objtextfile

set objfso = CreateObject("Scripting.FileSystemObject")
set objtextfile = objfso.OpenTextFile("f:logsystem.txt",8,True)

if WScript.Arguments(0) = "LOGIN" then
objtextfile.Write(vbCrLf & Date & " " & Time)
else
objtextfile.Write(" - " & Time)
end if

objTextFile.Close
Wscript.Quit

The output will be like:
11/7/2006 4:15:25 PM - 4:15:27 PM
11/7/2006 4:15:31 PM - 4:15:32 PM
11/7/2006 4:15:34 PM - 4:15:35 PM
11/7/2006 4:15:36 PM

To configure the script in your system you may use “gpedit.msc”. Under “User Configuration” -> “Windows Settings” -> “Scripts(Logon/Logoff)”.

This is the syntax:
[filename .vbs] LOGIN
[filename .vbs] LOGOFF

VN:F [1.1.6_502]
Rating: 0.0/5 (0 votes cast)
Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • DotNetKicks
  • LinkedIn
  • Live
  • MySpace
  • StumbleUpon
  • Technorati

Related posts:

  1. Download any file from ASP.NET
  2. Windows 7 Versions
  3. Windows ReadyBoost
  4. Difference between Windows Vista Editions
  5. Windows Command line reference