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 > Misc Newsgroups > VB Script

Vista - Win XP WMI WSH, SetInterfaceMetric not working

Reply
 
Old 08-01-2008   #1 (permalink)
Jimbo


 
 

Win XP WMI WSH, SetInterfaceMetric not working

Guys,

Here's a snippet of code I am trying to run at Logoff of the user:

' Make sure the IP address is set to automatic and that the
Interface metric is set to automatic.
' Get the collection of configurations to the NIC card with the
MAC address of strMACaddress

colConfigs = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration where
((IPEnabled=TRUE) and (MACaddress = '" & strMACaddress & "'))")

' Let DHCP automatically assign the IP address and set the
interface metric back to automatic
For Each objConfig In colConfigs
objConfig.EnableDHCP()
intResult = objConfig.SetIPConnectionMetric(200) ' 0
means automatic?
Next

The NIC card is already enabled with TCP/IP protocols. The EnableDHCP
method definitely works. However, the SetIPConnectionMetric method only sets
the metric to the value of 1 no matter what value I use at the parameter.
What's wrong with it? I also want to set it back to automatic metric. What
value do I use for that, maybe zero? I tried that, and it still results with
a value of 1.

Second issue... Vista users are lucky in that they can use the Enable and
Disable methods as well as the NetEnabled property in the
Win32_NetworkAdapter class. Sadly, they are unavailable to Win XP users.
What is the script work around for XP users? At least for the NetEnabled
property, I can use NetConnectionStatus<>0 to show an enabled status.

Thanks in advance for any help here.

... Jim ..



My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
windows vista restore not working/blue screen help/safe mode not working Vista General
MS Intellipoint stopped working but ctrl panel says working proper Vista hardware & devices
Re: Vista Internet not working, Ping by DNS is working Vista networking & sharing
Re: Right click stops working/New tabs stop working/Menu bar disappear Vista performance & maintenance
Creative Audigy 2 drivers working on Vista Working Vista hardware & devices


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