We use kixscripts to script package installation to users pc's. Users have locked down environment an dhave little or no local admin rights.

We have packages for Oracle 6i and Oracle8i. The PATH entry for each MUST appear at the front of the PATH variable When both packages exist on one pc the Oracle 8i path entry MUST appear before the 6i entry regardless of in which order they are installed.

I think the best way is for the Oracle 8i MSI to set its entry (C:\Oracle8i_home\Bin) as set at beginning of path. But for 6i install to not have its path entry (C:\ORANT\Bin) in the MSI but have KIX query the PATH for the existence of C:\Oracle8i_home\Bin and if found make the PATH start as C:\Oracle8i_home\Bin;C:\ORANT\Bin;xxxxx;xxxxx but if the C:\Oracle8i_home\Bin is NOT found then the PATH would start as C:\Orant\Bin;xxxxx;xxxxxx

If that is correct how could I get KIX to do that? I could see INSTR but the scripting isn't up to working how to use it acheive what we need.

Any help gratefully received.

0 Comments   [ - ] Hide Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity



You could get the registry value:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment[path]

Parse out the values at ";" then add your new variable to the beginning of the path.

Use Regini.exe to add to the path as admin.

I'm not sure if that's what you were looking for or not? Are you looking for an actual script.
Answered 11/17/2006 by: Secondlaw
Third Degree Blue Belt

Please log in to comment
Unfortunately I don't know how to parse and get the C:\Orant\Bin as the second entry when relevant. This is part of a software install kixscript which runs at SYSTEM so we can update PATH - just the users can't.

A script would be great!!

Thanks in advance
Answered 11/17/2006 by: glwday
Orange Belt

Please log in to comment
Parse was the wrong term for this one. You just need to set a variable, extract the key, append the key to your variable and replace it into your registry.

I'm not familiar with kix, but I did take a look at it. Unfortunately, everytime I tried something with it, it logged me out of my PC.

Can you use an alternative? I can create a Winbatch or autoit script, or even SMS Installer / Wise...
Answered 11/17/2006 by: Secondlaw
Third Degree Blue Belt

Please log in to comment
I found this in the scripts section - but it doesn't seem to work. Can anybody see whats wrong?

$mystring=ReadValue ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "Path")
Function SEARCHREPLACE($mystring, $search, $replace)

If Len($mystring)
While InStr($mystring, $search)<>0
$mystring=SubStr($mystring, 1, InStr($mystring, $search)-1) + $replace + SubStr($mystring, InStr($mystring, $search)+Len($search), Len("$mystring")-Len(SubStr($mystring, 1, InStr($mystring, $search)-1))-Len($search))

Answered 11/20/2006 by: glwday
Orange Belt

Please log in to comment
okey, so its been along time since I used kixtart but here goes.

$sPath=ReadValue ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "Path")
$aPath= split($sPath, ";")

For $i = 0 To Ubound($aPath-1)
If $aPath($i) = "C:\ORANT\Bin"
$sPathValue = "C:\Oracle8i_home\Bin" + $aPath($i)
$sPathValue = $aPath($i)

If $i <> Ubound($aPath-1)
$sPath = $sPathValue + ";"
$sPath = $sPathValue


Sorry for any syntax is incorrect but hope it helps in any way.
EDIT: fixed a code bug ;)
Answered 11/20/2006 by: AngelD
Red Belt

Please log in to comment
By the way... If Autoit is an option:

$CurrentPath = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment","path")
$AddtoPath1 = ("C:\Oracle8i_home\bin\;")
$AddtoPath2 = ("C:\Orant\Bin;")

$checkstr = StringInstr ($CurrentPath, $AddtoPath1)
$checkstr2 = StringInstr ($CurrentPath, $AddtoPath2)

$NewPath = $CurrentPath

If $CheckStr == 0 then
$NewPath = $AddtoPath1 & $NewPath

If $checkstr2 == 0 then
$NewPath = $AddtoPath2 & $NewPath

Regwrite ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "Path", "REG_SZ", $NewPath)

Good luck.
Answered 11/20/2006 by: Secondlaw
Third Degree Blue Belt

Please log in to comment
These are great scripts folks but remember... It's bad practice in this day and age to be modifying the path variable at all. You should really be using the application paths in the registry. This should work in the same way as the path variable. Also because these keys are not just one long entry like path and is seperated for each app you wont have to worry about order.

The spanner in the works.....The application may be hard coded to look at the path variable rather than just attempting to call the executable without a path and letting the OS deal with the rest.
Answered 12/21/2006 by: ColinBragg
Senior Yellow Belt

Please log in to comment