#64379 - 2002-04-09 11:59 PM
Error codes
|
Chris Bingel
Fresh Scripter
Registered: 2002-04-09
Posts: 22
Loc: Baltimore, MD
|
OK, I'm confuzzled.
Here is the offending snippet:
code:
:TIME SETTIME "CONSTELLATION"
IF @error <> 0 GOTO WRITEERROR ENDIF
...
:WRITEERROR
IF OPEN(1,"C:\kixtart.log",5) = 0 WRITELINE(1,@USERID + CHR(9) + @DATE + CHR(9) + @TIME + CHR(9) + @LSERVER + CHR(9) + $err + CHR(9) + @serror + CHR(13) + CHR(10)) ELSE BEEP MESSAGEBOX("Errors running logon script and unable to open log file.","WARNING!",0+48+0+0,10) ENDIF
The problem is that the writeerror piece is outputting a return code of 0. What between the SETTIME and WRITELINE is generating a new @ERROR, and how do I get around it? [ 10 April 2002, 00:04: Message edited by: Chris Bingel ]
|
|
Top
|
|
|
|
#64381 - 2002-04-10 07:13 AM
Re: Error codes
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,
We think that you should change $err to $error in your writeline statement. greetings.
|
|
Top
|
|
|
|
#64384 - 2002-04-10 01:23 PM
Re: Error codes
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Just to make sure we're answering the right question...
Both WriteLine() and MessageBox() are functions that return a value.
If you don't care about the return value then supress the code using a variable assignment otherwise it will appear on the console, i.e.
code:
$Nul=WriteLine(...
and
code:
$Nul=MessageBox(...
|
|
Top
|
|
|
|
#64387 - 2002-04-10 04:40 PM
Re: Error codes
|
Chris Bingel
Fresh Scripter
Registered: 2002-04-09
Posts: 22
Loc: Baltimore, MD
|
Curiouser and curiouser...
made the suggested change, and now the code breaks at a new point:
code:
:LOGONBANNER WRITEVALUE ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","LegalNoticeCaption","Legal Notice","REG_DWORD") IF @error <> 0 $error = @error $serror = @serror GOTO WRITEERROR ENDIF
...
:WRITEERROR
IF OPEN(1,"C:\kixtart.log",5) = 0 WRITELINE(1,@USERID + CHR(9) + @DATE + CHR(9) + @TIME + CHR(9) + @LSERVER + CHR(9) + $err + CHR(9) + @serror + CHR(13) + CHR(10)) ELSE BEEP MESSAGEBOX("Errors running logon script and unable to open log file.","WARNING!",0+48+0+0,10) ENDIF
And this outputs to c:\kixtart.txt:
code:
tester 2002/04/10 10:36:07 \\CON-BALT-PDC01 The operation completed successfully.
|
|
Top
|
|
|
|
#64389 - 2002-04-10 04:44 PM
Re: Error codes
|
Chris Bingel
Fresh Scripter
Registered: 2002-04-09
Posts: 22
Loc: Baltimore, MD
|
Ta.
But before I do that...MORE COFFEE!!!
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1110 anonymous users online.
|
|
|