Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

login logout .bat script

Posted on 2004-09-02
3
Medium Priority
?
659 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 1000 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

A small collection of useful tips and tricks for Windows 10 users that I decided to write as a result of recent questions that were asked and answered at Experts Exchange. Two short video tutorials included. Enjoy..
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

916 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