Ok.. so my first "Self-Written" script. I've got a few questions, mainly the whole "Whats the Right Way" to do things.. so, here's the basic idea of the code. I've written it to deal with the 60 some odd left over PC's on my network that are all Windows 98. Within the next year they should all be phased into Windows XP, where I can utilize SuS to roll out all my Windows updates.

I'm forced to do these remote installs because I have 5 remote offices, some of which are a day's travel away, costing more than 300 bucks to get there the cheap way. I can't rely on anyone in these remote offices to do the installs for anyone.

code:
; Sub-Login script designed to check and see if KAF Approved
; updates are installed, and if not install them.
; this script is used only by Windows 98 clients firmwide.

Break on

:Main
if ReadValue("HKEY_LOCAL_MACHINE\Software\KAF\Updates\q823718", "Installed")

else
Shell @LDRIVE + "\Win98Updates\q823718_MDAC_SecurityPatch.exe /q /r:n"
WriteValue("HKEY_LOCAL_MACHINE\Software\KAF\Updates","q823718","Installed",REG_SZ)
endif

if Readvalue("HKEY_LOCAL_MACHINE\Software\KAF\Updates\q329414", "Installed")

else
Shell @LDRIVE + "\Win98Updates\q329414_mdacall_x86.exe /q /r:n"
WriteValue("HKEY_LOCAL_MACHINE\Software\KAF\Updates","q329414","Installed",REGSZ)
endif

So, basically, I want to check and see if the Q article number regkey exists and says Installed. I could probably check to see if it exists period, since I'm the one writing those keys later in my script. Here's my Q's.

1. I'm sure there is a better way to do the whole if Readvalue thing, since I'm basically checking to see if it exists.. to cut out an Else I should probably check to see if it DOESN'T exist, right? Would that be this?
code:
if readvalue("HKEY_LOCAL_MACHINE\software\KAF\Updates\q329414",) = "0"
Shell Blah blah

I'm not Sure thats right.

Edit: Or maybe this:
code:
 if Keyexist("HKEY_LOCAL_MACHINE\Software\KAF\Updates\q329414") = 0
Shell Blah Blah

Just found the KeyExist function.. would that be a better way?

2. I plan on calling this from my Current Kix Login script, which is just an Ansi-GUI screen that draws a progress window accross the screen. (All Credit goes to Ben Burnett.) In doing this, is there a way I can pass a switch back to the original Kix Login Script that I call the above code from, just so I can conditionally check to see if the sub-script worked properly? Just Exit(errorNo)? Even More additionally, can I pass a string of Variables back, so I could perhaps set an error number for every patch I install?

3. Lastly, is there any reason I should make this a seperate login script file, or would it be more "Right" to make this all one script.. that would eliminate me having to pass error codes back to the main Login script, as I could just put my error checking right in as the code is run.

Thanks for the help!

[ 20. August 2003, 23:30: Message edited by: Clancy ]