I found an example that uses the EnumKeys/EnumValue functions, I have looked at he WriteValue function and I need help tying these together. A non working example is below. I need to identify the MTU Value Data to a 1400 decimal value.

How do I tie EnumValue and WriteValue togther?
Code:
  
; EnumKeys.KIX
;
; Enumerates a (registry) key and all its subkeys
;
; Note : This code sample is provided for demonstration purposes only.
; Microsoft makes no warranty, either express or implied,
; as to its usability in any given situation.
;
; Copyright (C) 2001 Ruud van Velsen.
; All rights reserved.
;
BREAK ON

IF $Key = 0
$Key = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces"
ENDIF


;
; first enumerate all subkeys of current key
;
DIM $Index, $SaveKey

$Index = 0
$SubKey = EnumKey( $Key , $Index )

WHILE @ERROR = 0

$SaveKey = $Key

$Key = $Key + "\" + $SubKey

? $Key

CALL EnumKeys

$Key = $SaveKey
IF @ERROR = 0

; try for next subkey

$Index = $Index + 1
$SubKey = EnumKey( $Key , $Index )
ENDIF

LOOP

;
; Lastly, enumerate all values of current key
;
$Index = 0
$Value = EnumValue( $Key , $Index )

WHILE @ERROR = 0
? $Key + "|" + $Value
$Index = $Index + 1
$Value = EnumValue( $Key , $Index )
LOOP

WriteValue( $Key , $Value "MTU", "1400", "REG_DWORD")
If @ERROR = 0
? "Value written to the registry"
Endif


EXIT 0



Edited by JTestman (2005-11-30 08:28 PM)