Hello!I'm developing my login scripts. Some days ago I had to distribute one URL to user desctops. I wrote a script (applied in attachment)
But I cannot understand, why it is not working properly. Script must write any data to a log file. But it writes only a first string.
When I run it in debug mode from a local computer, it works. From NETLOGON - fails. Can You explain,what is the difference?
What's happened?
Regards
------------CODE--------
; HelpDesk install
Global $HDLogFile, $hdmsg, $hd, $trg
$HDLogDir="\\spetntp1\log\"
$HDLogFile=$HDLogDir+LCASE(@USERID)+".log"
;
;write header to a log file
;
$hdmsg="DATE: "+@DATE+" Kix Version: "+@KIX
gosub logevt
;
;check is the source file exist in NETLOGON$
;
$hd="helpdesk.url"
if exist($hd)
$hdmsg="Source file found!"
gosub logevt
goto install
else
$hdmsg="Source file not found"
gosub logevt
exit 1
endif
:install
;
;OS - Win 95. Copy HelpDesk.URL to c:\windows\desktop and
;common desktop, if multiprofiles are switched on
;
if @INWIN=2
;write an OS type to Log File
$hdmsg="OS - Windows 95"
gosub logevt
$shpath1="c:\windows\desktop"
$shpath2="c:\windows\all users\desktop"
$trg=$shpath1+"\" + $hd
gosub copyhd
$trg=$shpath2+"\" + $hd
gosub copyhd
endif
if @INWIN=1
;write an OS type to Log File
$hdmsg="OS - WinNT"
gosub logevt
$shpath="c:\winnt\profiles\all users\desktop"
$trg=$shpath+"\" + $hd
;write shotcut to common desktop
;will not affect if user is not local admin
gosub copyhd
$shpath="c:\winnt\profiles\"+@USERID+"desktop"
$trg=$shpath+"\" + $hd
;write shotcut to user desktop
gosub copyhd
endif
;
;end script
;
exit
:copyhd
$hdmsg="Target file is "+$trg
gosub logevt
; exit from subroutine if target file exists
if exist($trg)
$hdmsg="Target file allready exists"
gosub logevt
goto endcopy
else
copy $hd $trg
endif
;check results of copying
if exist($trg)
$hdmsg="copying successful!"
gosub logevt
endif
:endcopy
return
;write message to a KIX screen and to a Log file at once
;parameter: $hdmsg - string
:logevt
? "$hdmsg"
;redirect output to a file
$rez=RedirectOutput($HDLogFile)
? @TIME+" "+$hdmsg
; redirect output back to screen
$rez=RedirectOutput("")
return
----------------------
OUTPUT
12:36:52 DATE: 2000/02/21 Kix Version: 3.62
----------------------