Page 1 of 1 1
Topic Options
#142561 - 2005-06-28 04:16 PM Tools
clementp1 Offline
Fresh Scripter

Registered: 2005-06-28
Posts: 12
Hello all.

I am a complete newbie to kix and I need to use it to install a small app.

All the kix script needs to do is check for a registry key and if it's not there copy a cross one small exe then add a statement to the registry to run it on start-up.

As I need to have this up and running ASAP,is there a GUI tool that can help me write this?……I’m having a stuck between a rock and hard place moment!

Many thanks in advance!

Paul

Top
#142562 - 2005-06-28 06:01 PM Re: Tools
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
No GUI tools.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#142563 - 2005-06-28 06:28 PM Re: Tools
StarwarsKid Offline
Seasoned Scripter
*****

Registered: 2005-06-15
Posts: 506
Loc: Oregon, USA
clementp1,

I've been watching this board for the past 6 months now and from what I've seen you're issue can be resolved very quickly. I'm not an expert on KiX so I don't know exactly how to construct the script, but there are tools 1. checking registry key existance/content, then 2. copying an executable, then 3. creating/editing a reg key.

Read the definitions for READVALUE, WRITEVALUE, and COPY that are in the KiXtart Manual that comes with the KiX download files.

I'm sure a regular of this board could whip this code up in one minute.

Try something like:
Code:
 
IF READVALUE("HKEY_LOCAL_MACHINE\blah\blah\blah)
COPY "network location" "local location"
WRITEVALUE("HKEY_LOCAL_MACHINE\blah\blah\blah)
ENDIF



You should wait until a regular verifies my example before following it, though.

You may also consider using the following to verify the files existance and then copying the file and writing the reg key.
Code:
 IF INGROUP ("UserGroup")
$Result = CompareFileTimes("v:\folder\file.exe", "%windir%\file.exe")
IF $Result = 1 or $Result = -3 ; '1'=File1 is more recent than file2, '-3'=File2 couldn't be open (nonexistant)
COPY "v:\folder\file.exe" "%windir%\file.exe"
WRITEVALUE("HKEY_LOCAL_MACHINE\blah\blah\blah)
ENDIF
ENDIF

_________________________
let the wise listen and add to their learning,
and let the discerning get guidance- Proverbs 1:5

Top
#142564 - 2005-06-28 06:29 PM Re: Tools
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, you can have a kixtarter, that is a gui tool... it has a gui and it is editor which in my mind is tool-class.

anyway, the task of yours is simple and thus asap is no problem.
put little mind into it and you should have working code today.
_________________________
!

download KiXnet

Top
#142565 - 2005-06-28 06:38 PM Re: Tools
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hey kid, nice post!
_________________________
!

download KiXnet

Top
#142566 - 2005-06-28 09:23 PM Re: Tools
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: CA
Hello clementp1 and welcome to the board.

Please post the EXACT details of what you're attempting to do.

Note though that if you're not already running KiXtart then you'll need to setup the logon scripts to do this, etc...

I'm sure one of the members here would be willing to give you some SILVER PLATTER code if you supply the full details.
 

Top
#142567 - 2005-06-29 01:24 AM Re: Tools
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Quote:

well, you can have a kixtarter, that is a gui tool... it has a gui and it is editor which in my mind is tool-class.





Then so is my Notepad, neither of which will type the code for me.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#142568 - 2005-06-29 01:59 AM Re: Tools
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yes, but kixtarter does help you write this.
it does have coloring, so you see nice colors and are relaxed when you write your code.
isn't that helping?

and, starwarskid already started providing some silver stuff...
all clementp1 needs is to receive.
_________________________
!

download KiXnet

Top
#142569 - 2005-06-29 02:41 AM Re: Tools
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
So.. no drag 'n' drop, just copy/paste.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#142570 - 2005-06-29 03:52 AM Re: Tools
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
But StartWarsKid's code is not silver platter as it wouldn't work.
Code:

IF 0=READVALUE('HKLM\SOFTWARE\SomeApp','installed')
COPY '\\server\share\dir\file.txt' 'c:\program files\someapp\file.txt'
$rc=WRITEVALUE(''HKLM\SOFTWARE\SomeApp','installed',1,'REG_SZ')
ENDIF


Then add code to add a registry valueinto the RUN section to automatically run the process. Of course, this could all be done via remote admin script as well, but as there are no details provided,...
_________________________
There are two types of vessels, submarines and targets.

Top
#142571 - 2005-06-29 11:55 AM Re: Tools
clementp1 Offline
Fresh Scripter

Registered: 2005-06-28
Posts: 12
Thanks for all the help and replies! It's great to see a community such as this.

I found the Kixtater editor and managed to coble together the following: -
_____________________________________________________________________
? "Websense Login App check\install"


? "OS TYPE="

@PRODUCTTYPE

if (@producttype = "windows 95")
or (@producttype = "windows 98")
or (@producttype = "windows ME")
or (@producttype = "Windows 2000 Professional")
or (@producttype = "Windows XP Professional")

? "Checking Key"
DIM $key
$key=""
$key=READVALUE("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run","LoginAgent")

if $key=""
? "Creating Key"
COPY "\\artemis\loginapp.exe" "c:\loginapp.exe"
WRITEVALUE("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run","LoginAgent","LogonApp.exe http://192.168.61.12:15880/websense /PERSIST","REG_SZ")
else
? "Key Found"
endif

? "Checking File"
DIM $file
$file=""
$file=EXIST("c:\LogonApp.exe")
if $file="0"
? "Coping file"
Copy @LSERVER+ "\netlogon\LogonApp.exe" "c:\LogonApp.exe"
else
? "File found"
endif

endif

? "done!"


I know it’s not the most exciting script and I’ve properly gone about things in the wrong way but it works!

I’m very impressed with the power of Kix and will be looking into it further.

Once again thanks for all your help!

Top
#142572 - 2005-06-29 01:31 PM Re: Tools
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
silver is a good word... he had some silver in his post and if made working, it would give you that platter
_________________________
!

download KiXnet

Top
#142573 - 2005-06-29 05:59 PM Re: Tools
StarwarsKid Offline
Seasoned Scripter
*****

Registered: 2005-06-15
Posts: 506
Loc: Oregon, USA
Lonkero/anyone,

Beyond placing his code into the proper code post and tabbing the if, endif statements, how would you simplify/cleanup this code? I'd be interested to know. It appears that there are many ways to skin a KiX script...

For example: Is it allows to define a DIM variable with two seperate definitions? Code:
 DIM $key
$key=""
$key=READVALUE("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run","LoginAgent")


THANKS!
_________________________
let the wise listen and add to their learning,
and let the discerning get guidance- Proverbs 1:5

Top
#142574 - 2005-06-29 07:07 PM Re: Tools
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: CA
All he is doing is making sure that $Key is blank however not really needed in this case.

Yes, there are many ways to skin a cat. Here is his code re-written (NOT TESTED)
 
Code:
Dim $sComputer,$ServerCheck,$Set,$File,$RunValue
$RunValue='LogonApp.exe http://192.168.61.12:15880/websense /PERSIST'
$ServerCheck=ReadValue('HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions','ProductType')
If $ServerCheck='WinNT'
If Not ReadValue('HKLM\Software\Microsoft\Windows\CurrentVersion\Run','LoginAgent')
;COPY "\\artemis\loginapp.exe" "c:\loginapp.exe"
;Think the above is a typo
COPY "\\artemis\logonapp.exe" "c:\logonapp.exe"
;$Set=WriteValue('HKLM\Software\Microsoft\Windows\CurrentVersion\Run','LoginAgent',$RunValue,REG_SZ)
;Unless the user has local admin rights they won't be able to write to HKLM
$Set=WriteValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Run','LoginAgent',$RunValue,REG_SZ)
EndIf
If Not Exist('c:\LogonApp.exe')
Copy @LSERVER+'\netlogon\LogonApp.exe' 'c:\LogonApp.exe'
EndIf
EndIf


 

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 661 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.112 seconds in which 0.062 seconds were spent on a total of 12 queries. Zlib compression enabled.

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