Solved

login logout .bat script

Posted on 2004-09-02
3
627 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

This article is a collection of issues that people face from time to time and possible solutions to those issues. I hope you enjoy reading it.
This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

623 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