Page 1 of 1 1
Topic Options
#190523 - 2008-11-06 03:53 PM Len of a Variable Causing Fatal Exception
pepper Offline
Fresh Scripter

Registered: 2005-04-21
Posts: 21
Hello,

I have a script that loops through a list of machine names and checks a registry key. It works fine for 99% of the machines, but on a few, I get a "fatal exception occurred" when it hits the "If Len" line below, and the script quits.

 Code:
$SROOTVAR = ReadValue($REMOTEMACHINE + "\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion","SystemRoot")
	If Len($SROOTVAR) > 2


If it can't see the key or it's otherwise empty, shouldn't it just return blank or 0? What about trying to find the length of $SROOTVAR could cause Kix to crash?

Thanks!

Top
#190524 - 2008-11-06 06:12 PM Re: Len of a Variable Causing Fatal Exception [Re: pepper]
pepper Offline
Fresh Scripter

Registered: 2005-04-21
Posts: 21
OK, I tried to see if there was an error after it got the registry key, but it returns 0. And, if I put that bit of code in its own kix, it runs fine. :? I tried using the Sanity() script to catch the fatal exception error, but it still errors out and doesn't catch anything as far as I can see. Is there any way I can see what this "fatal exception" actually is?
Top
#190526 - 2008-11-06 08:12 PM Re: Len of a Variable Causing Fatal Exception [Re: pepper]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Let's see more of the actual script and not just that snippet please.

Also what version of KiXtart and are any of these remote systems Vista or 64 Bit ?

Top
#190528 - 2008-11-06 10:16 PM Re: Len of a Variable Causing Fatal Exception [Re: NTDOC]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I'm with doc here.
my guess is that the next line after your if line is causing the exception...
_________________________
!

download KiXnet

Top
#190547 - 2008-11-10 03:22 PM Re: Len of a Variable Causing Fatal Exception [Re: Lonkero]
pepper Offline
Fresh Scripter

Registered: 2005-04-21
Posts: 21
Thank you both... it turns out this was a Linux machine. I'm not sure why it worked sometimes and other times it didn't, but I have added some code to stop it from trying to get certain information from a machine if it's not Windows. Thanks again for your help \:\)
Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1080 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.141 seconds in which 0.077 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org