captaincrash0815
(Fresh Scripter)
2005-03-24 11:55 AM
Problem with Pathmod Script

Hello.

I have a problem with pathmod. When i start my pc, kix change the path. Thats OK. But when i start the pc next time, i cannot use net use or regedit in the dos cmd. Any Idea ?


LonkeroAdministrator
(KiX Master Guru)
2005-03-24 12:52 PM
Re: Problem with Pathmod Script

this is the same problem you had before, no?

what you mean you can't use "net use"?


Les
(KiX Master)
2005-03-24 03:21 PM
Re: Problem with Pathmod Script

I would surmize that you are destroying the existing path rather than appending to it but without seeing any code, I can only surmize. Since Johnny died, my Carnac hat doesn't work any more and my crystal ball is in the shop.

**DONOTDELETE**
(Lurker)
2005-03-24 03:29 PM
Re: Problem with Pathmod Script

OK. Here is the code. On 150 PC's the path variable is dead. The Value that i want to change is right and programm runs but the commands net use,regedit,cmd... are dead. Please Help
Code:

$CValue = "\\rassmus\terawin\system"
$RValue = "\\geodaten\terawin\system\"
$RC1 = PathMod($CValue, $RValue)

$CValue = "\\rassmus\terawin\system\"
$RC2 = PathMod($CValue, $RValue)

; $CValue = "\\geodaten\terawin\system\"
; $RValue = "\\geodaten\terawin\system"
$RC3 = PathMod($CValue, $RValue)

; Rckgabewerte :
; 0 Eintrag wurde gefunden und Pfad wird ge„ndert
; 1 Fehler : Eintrag konnte nicht geschrieben werden
; 2 $CValue wurde nicht gefunden oder ist leer
; 3 $RValue wurde nicht gefunden oder ist leer
;
Function PathMod($CValue, $RValue)
Dim $Array, $aCntr, $KeyVal2, $fCntr, $stat, $KeyLoc, $Keynam
$aCntr = 0
$fCntr = 0
$stat = "FALSE"
$KeyLoc = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
$keyNam = "Path"

If $CValue = "" OR $RValue = ""
Select
Case $CValue = ""
$Pathmod = 2
Case $RValue = ""
$Pathmod = 3
EndSelect
Return
EndIf

$KeyVal = ReadValue ($KeyLoc, $KeyNam)
$RegType = READTYPE($KeyLoc,$KeyNam)
$Array = Split($KeyVal,";",-1)
For Each $Element In $Array
If $Element = $CValue
$Array[$acntr] = $RValue
$stat = "TRUE"
EndIf
$acntr = $acntr + 1
Next

If $Stat = "TRUE"
For Each $Element In $Array
If $fCntr = 0
$KeyVal2 = $element
$fcntr = 1
Else
$keyVal2 = $KeyVal2 +";"+ $Element
$fcntr = $fcntr + 1
EndIf
Next

$RC = WriteValue($Keyloc,$KeyNam,$KeyVal2,"REG_EXPAND_SZ")

; $RC = WriteValue($Keyloc,$KeyNam,$KeyVal2,$REGTYPE) // Wegen Problem ausnahmsweise auf REG_EXPAND_SZ .....
; SETM "Path=$KeyVal2"
If $RC = 0
$PathMod = 0
Return
Else
$Pathmod = 1
Return
EndIf
EndIf
EndFunction



added code tags - Bullock


Les
(KiX Master)
2005-03-24 03:48 PM
Re: Problem with Pathmod Script

Please use code tags when posting code and also post what the path was befor it got mucked up and after.

LonkeroAdministrator
(KiX Master Guru)
2005-03-24 04:49 PM
Re: Problem with Pathmod Script

resetting path you said?
Code:
;		SETM "Path=$KeyVal2"