Solved

report of login and logout of computer

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

Join & Write a Comment

In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
Synchronize a new Active Directory domain with an existing Office 365 tenant
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now