Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Vista Newsgroups > Vista General

Vista - resetting LAN connection metric

Reply
 
Old 01-10-2007   #1 (permalink)
dak


 
 

resetting LAN connection metric

I have been using the following vbscript to reset the connection metric on my
LAN. I am having problems getting it to work in Vista. Everthing seems to run
correctly but the value is not reset (when I look at the properties of the
Local Area Connection / properities of the TCPIP and Advanced). Also if I
rerun this script the value remains the same and is not the value I am
setting it to. I am running from an admin command prompt. I am guessing the
addition of IPv6 may have added new variables and the setipconnectionmetric
may have been renamed? Any ideas?

--------------------
On Error Resume Next

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

regValueDataMetric = "35"

Set colItems = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapter Where NetConnectionID = 'Local Area
Connection'")

For Each objItem in colItems
strMACAddress = objItem.MACAddress
Wscript.Echo "MACAddress: " & strMACAddress
Next

Set colNetCard = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")

For Each objNetCard in colNetCard
If objNetCard.MACAddress = strMACAddress Then
For Each strIPAddress in objNetCard.IPAddress
Wscript.Echo "Description: " & objNetCard.Description
Wscript.Echo "IP Address: " & strIPAddress
Wscript.Echo "IPConnectionMetric: " & objNetCard.IPConnectionMetric
objNetCard.SetIPConnectionMetric(regValueDataMetric)
Next
End If
Next

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
general question re resetting/renewing IP connection Vista networking & sharing
3.5" x 17" lathe and chuck package, metric .NET General
Two NICs with identical gateway metric Vista networking & sharing
resetting LAN connection metric in VISTA Vista General
Metric Bug in Vista for multiple DSL connections Vista networking & sharing


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46