Go to
for kix scripts (and other scripting language) examples.
I'm not sure about the logging question of whether the file will get locked if two people logon at the exact same time. I would think it would. A solution to this is to have individual log files created for each user. Then, when you want to see a report, run a batch file that generates a concatination of all of the individual log files. (note: in your script, make sure that you have logic where the script checks for an existing log file and deletes it before creating a new log file)
This is an example of the report generator:
for /f %a in ('dir /s /b /a-d') do type %a | find "++++" >>c:\report.txt
bsmith.txt would have to have text inside that has "++++" before and after for to be captured in the log.
Here is a script that will open an log and capture some of the information you want.
; Use OpenLog to create a new log
; Use EndLog to close the log
; Use LogItem before and after the routine you want to measure
; Some variables are not available under WinNT.
; SESSIONNAME variable is used when running it
; on a terminal server/citrix server
$NoTimeStamp=1
:OpenLog
; Here the logfile is created
; The computername
if "%SESSIONNAME%"=""
$logpath="\\server\errorlog$\timing\%COMPUTERNAME%-kix.txt"
else
$logpad="\\server\errorlog$\timing\%CLIENTNAME%-kix.txt"
endif
del "$logpad"
$x=Open(2, $logpad,5)
$x=LogItem("Begin Logging")
$x=LogItem("General information",$NoTimeStamp)
$x=LogItem("===================",$NoTimeStamp)
$x=LogItem("Logon server : %logonserver%",$NoTimeStamp)
$x=LogItem("Computer naam: %COMPUTERNAME%",$NoTimeStamp)
$x=LogItem("Home share : %homeshare%",$NoTimeStamp)
$x=LogItem("User : %username%@@%userdnsdomain%",$NoTimeStamp)
return
:EndLog
; Logfile is closed
$x=LogItem("End Logging")
close(2)
return
function LogItem ($ctext,optional $timestamp)
; A logitem is written to the logfile
; preceeded by the current date and time
if $timestamp=$NoTimeStamp
$ctext="@date @time"+$ctext
endif
writeline (2,$ctext+ Chr(13) + Chr(10))
endfunction
Joseph L. Poandl
MCSE 2003
If your company is in need of experts to examine technical problems/solutions, please contact
(Sales@njcomputernetworks.com)