I am trying to set the MTU value on Windows 7 - I saw this in the forums but it doesn't work - was it only for Win XP?

 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.


I know I can run this command but I cannot get it to work in the script... I am probably missing something simple.

netsh interface ipv4 set subinterface "local area connection" mtu=1200 store=persistent

I am in a tight spot and need this to work! Hope someone on can help...

Thanks
Glenn


Edited by Mart (2015-01-19 09:28 AM)
Edit Reason: Please use code tags when posting code.