Solved

report of login and logout of computer

Posted on 2011-03-02
5
308 Views
Last Modified: 2012-06-22
hello expoerts i need to find the way
to know the first time that user login into their computer and when they log out.
the main idea of this is know at waht time the user star using his computer in the morning.


thanks guys
0
Comment
Question by:nickt25
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:Noduzz
ID: 35022170
My best recommendation is to create a login script to that logs that info either in a database remotely or log file on the machine or remote server.
0
 
LVL 5

Accepted Solution

by:
Noduzz earned 500 total points
ID: 35022207
0
 
LVL 47

Expert Comment

by:Donald Stewart
ID: 35022215
I use the following two .bat

The first one is the logon script and the second is the logoff.

This creates a running excel spreadsheet that you can go back to anytime and view when users have logged on or off
@echo off
echo %username%,,%computername%,,%date%,, %time%,,logged off>>\\server1\logs$\logoffs.csv


ENDLOCAL

Open in new window

@echo off

set loc=
set GW=
Rem Determine whether the session is a local logon or a RDP session

netstat -an |find "3389" |find /I "established" >C:\Result1.txt
For /F "tokens=3 delims= " %%A IN (C:\Result1.txt) DO SET loc=%%A
if (%loc%)==() set loc=console



REM you could use this next routine to determine the subnet(Branch office location) by grabbing the default gateway
Rem You can modify GW= to fit your environment
Rem Modify IP's below to match your subnet gateways

for /f "tokens=2 delims=:" %%a in ('ipconfig ^| find "Gateway"') DO SET GW=%%a
if %GW%== 10.63.106.2 set GW=Branch1    
if %GW%== 10.63.106.130 set GW=Branch2
if %GW%== 10.63.106.162 set GW=Branch3
if %GW%== 10.63.106.194 set GW=Branch4
if %GW%== 10.63.106.226 set GW=Branch5
if %GW%== 10.63.107.2 set GW=Branch6  
if %GW%== 10.63.107.34 set GW=Branch7
if %GW%== 10.63.107.66 set GW=Branch8
if %GW%== 10.63.107.98 set GW=Branch9
if %GW%== 10.63.107.130 set GW=Branch10
if %GW%== 10.63.107.162 set GW=Branch11
if %GW%== 10.63.107.194 set GW=Branch12   

REM this grabs the computer ip address


for /f "Tokens=2 Delims=[]" %%i in ('ping -n 1 "%computername%"') do set IP=%%i

Rem used double commas for readability
echo %username%,,%computername%,,%IP%,,%GW%,,%Loc%,,%Date:~0,16%,,%Time:~0,5%,,"logged on" >>\\server1\logs$\logins.csv 


ENDLOCAL

Open in new window

0
 
LVL 47

Expert Comment

by:Donald Stewart
ID: 35022225
The second one is the logon script (they got switched around when I posted)
0
 
LVL 3

Author Closing Comment

by:nickt25
ID: 35732700
tks :)
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

This article runs through the process of deploying a single EXE application selectively to a group of user.
This article outlines the process to identify and resolve account lockout in an Active Directory environment.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

821 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