#142561 - 2005-06-28 04:16 PM
Tools
|
clementp1
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
|
|
|
|
#142563 - 2005-06-28 06:28 PM
Re: Tools
|
StarwarsKid
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
|
|
|
|
#142570 - 2005-06-29 03:52 AM
Re: Tools
|
Sealeopard
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
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
|
|
|
|
#142574 - 2005-06-29 07:07 PM
Re: Tools
|
NTDOC
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
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(StuTheCoder)
and 798 anonymous users online.
|
|
|