Solved

report of login and logout of computer

Posted on 2011-03-02
5
307 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
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.

777 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