Page 1 of 1 1
Topic Options
#170891 - 2006-12-01 04:11 PM Running kix IF statement problems (or lack of knowledge)
DrWize Offline
Fresh Scripter

Registered: 2002-09-15
Posts: 11
Loc: Sweden
This is an script that I want to run om my computers. (Kixtart 4.51)

First I want to remove the Panda and then when the panda is removed I want to run the install script for F-secure, and finally when it is installed I dont want the script to run. Thats why I added the IF NOT EXIST statement. Now theres only one small problem left.. How do I make it work ?? The file PandaRemover contains a reboot when it finds the avengine, so the first reboot works.



Code:
DEBUG ON
IF EXIST ("%programfiles%\Panda Software\AVTC\avengine.exe")
? "Preparing to delete."
? "Loading the PandaRemove2 from network"
RUN "\\server4\Gemensam\kix\pandaunst\pandaremover.exe"
? "Pandoraremove2 har completed
ELSE
RUN ("msiexec /i \\server4\Gemensam\kix\pandaunst\Fsecure_CS6.03.msi /passive /norestart")
endif
_________________________
_ _________________ _ Computers make very fast, very accurate mistakes

Top
#170892 - 2006-12-01 04:56 PM Re: Running kix IF statement problems (or lack of knowledge) [Re: DrWize]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
If you add it to your login script ...

Code:
IF EXIST ("%programfiles%\Panda Software\AVTC\avengine.exe")
  RUN "\\server4\Gemensam\kix\pandaunst\pandaremover.exe"
ELSE
 If not Exist ;put a file to check for here
  RUN ("msiexec /i \\server\Gemensam\kix\pandaunst\Fsecure_CS6.03.msi /passive /norestart")
 EndIf
endif
_________________________
Today is the tomorrow you worried about yesterday.

Top
#170893 - 2006-12-01 05:00 PM Re: Running kix IF statement problems (or lack of knowledge) [Re: Gargoyle]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
I think Gargoyle just missed it but, 'Run' is a command not a function so you don't want the () it sould be:
Code:
RUN "msiexec /i \\server\Gemensam\kix\pandaunst\Fsecure_CS6.03.msi /passive /norestart"

_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#170894 - 2006-12-01 05:56 PM Re: Running kix IF statement problems (or lack of knowledge) [Re: Benny69]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
Also - Run happens asynchronously - that is, the script continues immediatley after starting the command - you don't really know if it completed or was successful. You should probably use "Shell" instead of "Run" (same syntax). This way, Kix will wait for the command to complete, and you can verify it was successful.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#170895 - 2006-12-01 06:15 PM Re: Running kix IF statement problems (or lack of knowledge) [Re: Glenn Barnas]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
good point Glenn.
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#170898 - 2006-12-01 06:54 PM Re: Running kix IF statement problems (or lack of knowledge) [Re: Glenn Barnas]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
But if the installer wants to reboot the SHELL will also hang the reboot process. However at least Glenn has enlightened you on possible issues and you will need to test things out to see what works best for you.
Top
#170909 - 2006-12-01 08:34 PM Re: Running kix IF statement problems (or lack of knowledge) [Re: NTDOC]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
"/norestart" was on the command line ;\)

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#170910 - 2006-12-01 08:58 PM Re: Running kix IF statement problems (or lack of knowledge) [Re: Glenn Barnas]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
But not on the Panda removal line, which is where he states it does reboot. ;\)
_________________________
Today is the tomorrow you worried about yesterday.

Top
#170927 - 2006-12-02 12:03 AM Re: Running kix IF statement problems (or lack of knowledge) [Re: Gargoyle]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
Having written significant amounts of installer scripts, I'd never let a sub-process reboot the system out from under a higher-level controlling app - it's just bad design. It removes all control, logging capability, and management from the primary application.

Most processes today return a code that indicates a successful install PENDING a reboot - best practice would be to check for that return code, write your logs, and let the script perform the reboot, not the underlying installer code.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#170970 - 2006-12-04 11:20 AM Re: Running kix IF statement problems (or lack of knowledge) [Re: Glenn Barnas]
DrWize Offline
Fresh Scripter

Registered: 2002-09-15
Posts: 11
Loc: Sweden
Thanks for the answers. Ill take the considerations about the subprocess reboot. Im thinking about deploying this using a GPO applied script at STARTUP, so Im not overly afraid about the reboot and what damage it will do to the computer (hopefully \:\) ). After the next reboot the script will check for the existence of Panda and when it cant find it it'll go into the installphase of F-secure. Ill try this right away ! Many thanks.

Nice to see the kixforums being so alive !!!
_________________________
_ _________________ _ Computers make very fast, very accurate mistakes

Top
#170972 - 2006-12-04 11:32 AM Re: Running kix IF statement problems (or lack of knowledge) [Re: DrWize]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Just remember that if for some reason you can't remove PANDA you should setup some logging or other code so it doesn't keep running and failing and then you don't even know it.
Top
Page 1 of 1 1


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

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

Generated in 0.16 seconds in which 0.088 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