Solved

login logout .bat script

Posted on 2004-09-02
3
605 Views
Last Modified: 2013-12-28
I have set up on the users login and logout scripts a way to track the users ip, username, computername, date, and time.  This works great for the w2k pro and xp workstations.  I am now trying to create a script so that i can get the same or something like that for my 98 client machines.  I have been testing somethings out and one thing i can do is set a variable in the autoexec.bat that states the computername.  This is teadous but i have to go to each machine anyway to do some other work.  Can any help me write a script so that i would be able to track a users login and logout of the system.  I have also been playing with extracting the registry key to get the username and i have got as far as to get it into a txt file but am having trouble assigning it to a variable.  Any help you could give would be great thanks in advance

Dave
0
Comment
Question by:davidvieira
  • 2
3 Comments
 

Expert Comment

by:GrooverMD
ID: 11982628
you need to do this in your config.sys ( brace delimiters included )
[MENU]
menuitem=LogOn
menuitem=LogOff
menudefault=Logon,30                      

( 30 denotes  time in seconds before default is actived. Logon is default, Menu won't get past logon )

[LogOn]                                            ( Need these even though they are empty )

[LogOff]

then in autoexec.bat

:start
if %config%==LogOn goto logon           ( checks the varible set by config.sys )
if %config%==LogOff goto logoff

:logon
set /p logonname=Enter Logon Name
echo > logon.txt %logoname%, %date%, %time%

win /3                                                ( after windows shuts down it will return to this batch file )
goto LogOff

:logoff
echo > logoff.txt %logoname%, %date%, %time%


will play around and write a better script for this unless someone's got better?
0
 

Accepted Solution

by:
GrooverMD earned 500 total points
ID: 11982669
Even better still get automenu from www.magee.com
0
 
LVL 1

Author Comment

by:davidvieira
ID: 11997405
i tried that and the date time and the script does not work.  What i was thinking is if i could assign a variable to a username from extracting it from the registry in the current user\ network\ logon there is a variable in there and parse out the name into a enviorment variable.

If i where to use net time at the server ie net time \\servername displays something like
 current time at \\servername is 9-7-2004 10:41a.m.
 the command complete sucessfully  

I got all this i just don't know how to parse the output in dos.  Likewise I am also unable to set that info into varibles.  I can place them into temp files but when i want to place all the info into one file it puts an endline after each line.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

766 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