Solved

login logout .bat script

Posted on 2004-09-02
3
600 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The use of stolen credentials is a hot commodity this year allowing threat actors to move laterally within the network in order to avoid breach detection.
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

744 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