This kix script generates a log file, but I do not like that it generates the name of the printer as installed on the pc and not the actual \\server\share name. I could probably change this using the ini file.

</font><blockquote><font size="1" face="Verdana, Helvetica, sans-serif">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">break on

;********** Prevent logon script on server *********
call @ScriptDir+'\osid.udf'

$os=osid()
if $os[2]<>'Workstation'
exit 0
endif

;********** Beginning of printer info gathering script *********
$PrtLog="\\ps-01\Prtlog$"
$PrtLog=$PrtLog+"\@wksta"+"_"+"@userid"
;$PrtLog=$PrtLog+"\@wksta"
if 0=exist($PrtLog)
MD $PrtLog
endif
$PrtLog=$Prtlog+"\default.log"
call "@scriptdir\getdefaultprinter.udf"

$rc=Get_Default_printer()

$rc=WriteLog2($PrtLog,Get_Default_Printer(),1)

;if (RedirectOutput("$PrtLog",1) = 0)
;endif


;-------------------------------------------------------------------------------;FUNCTION WriteLog2()
;
;AUTHOR Howard A. Bullock (hbullock@tycoelectronics.com)
;
;ACTION Generic logging facility for scripts. Appends log entry to a file with an
; optional TimeStamp.
;
;SYNTAX WriteLog2($File, $text, [0|1])
;
;PARAMETERS $File (Required) - String value
; $text (Required) - String value
; $TimeStamp (Optional) Default(0) no TimeStamp (1 or 0)
;
;
;REMARKS This function writes (appends) an optionally time stamped log entry to the file
; defined in function. This function searches for the first unused file handle,
; open the file, and write the entry. The file handle is then closed. When the
; function is unable to perform its it write the error is displayed in a message box.
;
;RETURNS Nothing
;
;DEPENDENCIES None
;
;EXAMPLES WriteLog2("junk.txt","This is a test")
; WriteLog2("junk.txt","This is a test",0)
; WriteLog2("junk.txt","This is a test",1)
;
Function WriteLog2($File, $Text, optional $TimeStamp)
dim $RC, $File, $text, $FH, $TimeStamp
$FH=1
$RC=Open ($FH, $File, 5)
while $RC = -3
$FH=$FH +1
$RC=Open ($FH, $File, 5)
Loop
Select
Case $RC=0
if ($TimeStamp=1)
$TimeStamp = @Date + " " + @Time + " - "
else
$TimeStamp = ""
endif
$RC=Writeline ($FH, $TimeStamp + $Text + @CRLF)
$RC=Close ($FH)
Case $RC=-2
$text = "WriteLog2: Invalid file handle ($FH) specified when trying to Open $File."
$RC=MessageBox ($text,"Script Error",48)
Case $RC=-1
$text = "WriteLog2: Invalid file name ($File) specified for log file."
$RC=MessageBox ($text,"Script Error",48)
Case $RC=>0
$text = "System Error($RC) while attempting to open log file ($File)."
$RC=MessageBox ($text,"Script Error",48)
Endselect
EndFunction[/code]</blockquote><font size="2" face="Verdana, Helvetica, sans-serif">sample contents of default.log
-------------------------
2003/09/24 10:05:43 - Q-MIS2 IP,winspool,Ne01:
2003/09/24 10:11:09 - NONE
2003/09/24 10:13:02 - Fax,winspool,Ne00:
--------------------------


Edited by tjcarst (2007-09-12 10:15 PM)