Page 2 of 2 <12
Topic Options
#152380 - 2005-12-01 04:18 AM Re: Change MTU?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
You can add a pause into your script. maybe inside your loop, with something like this:

? "Hit any key to continue..." get$

Top
#152381 - 2005-12-01 04:37 AM Re: Change MTU?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
The WriteValue() line is all wrong.

hint
It should look pretty much the same as my ReadValue() except a few more parms.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#152382 - 2005-12-01 04:39 AM Re: Change MTU?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Also, you took the task outside of the loop and the vars could have changed by then.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#152383 - 2005-12-01 05:03 AM Re: Change MTU?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Need more hints?
Replace the ReadValue() line with WriteValue(), taking out the parts that print to the screen and add the extra parm the function needs.

I generally post code using ReadValue() since it is safer for testing than WriteValue().
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#152384 - 2005-12-01 05:16 AM Re: Change MTU?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Code:
Break On
Dim $BaseKey, $Key, $Value, $RC
$BaseKey = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces'
For each $Key in ArrayEnumKey($BaseKey)
If AScan(ArrayEnumValue($BaseKey+'\'+$Key),'MTU')<>-1
'Value ['+ReadValue($BaseKey+'\'+$Key,'MTU')+'] in Key ['+$Key+']' ?
; $RC = WriteValue($BaseKey+'\'+$Key,'MTU','1400','REG_DWORD')
EndIf
Next

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#152385 - 2005-12-02 06:01 PM Re: Change MTU?
JTestman Offline
Fresh Scripter

Registered: 2005-11-28
Posts: 26
Les – Thank You! And to the rest of you Thanks!

I ended up not needing the ArrayEnumValue function do to the fact that some of the Systems don’t have the MTU setting configured.

Here is the code..


Code:

Break On
Dim $BaseKey, $Key, $RC, $MTUvalue

; Edit MTU value below.

$MTUvalue = '1400'
$BaseKey = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces'


For each $Key in ArrayEnumKey($BaseKey)
$RC = WriteValue($BaseKey+'\'+$Key,'MTU', $MTUvalue ,'REG_DWORD')
Next



;UDF Functions Do Not Edit!
;UDF Function ArrayEnumKey

function arrayenumkey($regsubkey)
dim $retcode, $subkeycounter, $currentsubkey, $subkeyarray

if not keyexist($regsubkey)
$arrayenumkey=''
return
endif

$subkeycounter=0
do
$currentsubkey=enumkey($regsubkey,$subkeycounter)
if $currentsubkey<>259 and @ERROR=0
redim preserve $subkeyarray[$subkeycounter]
$subkeyarray[$subkeycounter]=$currentsubkey
$subkeycounter=$subkeycounter+1
endif
until $currentsubkey=259 or @ERROR

$arrayenumkey=$subkeyarray
endfunction

;End UDF Functions.


Top
Page 2 of 2 <12


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.054 seconds in which 0.031 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