Solved

login logout .bat script

Posted on 2004-09-02
3
620 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

An article on effective troubleshooting
An introduction to the wonderful sport of Scam Baiting.  Learn how to help fight scammers by beating them at their own game. This great pass time helps the world, while providing an endless source of entertainment. Enjoy!
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
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…

734 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