Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Network Link Speed

25 views
Skip to first unread message

Carlos Felipe França da Fonseca

unread,
Apr 13, 2006, 5:12:08 PM4/13/06
to
I'm trying to use the following VBScript to get the configured speed on my
network adapter:

strComputer="."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter")
For Each objItem In colItems
WScript.Echo "Speed: " & objItem.Speed
Next

But nothing is being returned.

Does anybody know why?

Is there another way to get this information?

Thanks!!!

Felipe


Marty List

unread,
Apr 13, 2006, 6:51:34 PM4/13/06
to

The documentation says this about the .Speed property: "This property has not
been implemented yet. It returns a NULL value by default."
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_networkadapter.asp

I don't think there is a 100% accurate way to get the NIC speed. Some vendors
store it in the registry diffrently than others. This script may or my not be
usefult to you, but it will report Auto vs Forced. It will work on most network
adapters, but not all. I don't know if I wrote it or downloaded it, but I think
it was written for Windows 2000 and I've never updated it for Windows XP/2003.

Watch out for line wraps.

'==========================='
On Error Resume Next

Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &
strComputer & "\root\default:StdRegProv")
strKeyPath =
"System\Currentcontrolset\Control\Class\{4D36E972-E325-11CE-BFC1-08002be10318}"
strDriverValue = "DriverDesc"
strModeValue1 = "DuplexMode"
strModeValue2 = "SpeedDuplex"
strModeValue3 = "RequestedMediaType"

objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

For Each subkey In arrSubKeys
objReg.GetStringvalue HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey,
strDriverValue, strValue
WScript.Echo subkey & ": " & strValue
objReg.GetStringvalue HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey,
strModeValue1, dwValue
If dwValue <> "" then
WScript.Echo " " & strModeValue1 & ": " & dwValue
'0 - Auto Detect
'1 - 10Mbps \ Half Duplex
'2 - 10Mbps \ Full Duplex
'3 - 100Mbps \ Half Duplex
'4 - 100Mbps \ Full Duplex
End If
objReg.GetStringvalue HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey,
strModeValue2, dwValue
If dwValue <> "" then
WScript.Echo " " & strModeValue2 & ": " & dwValue
End If
objReg.GetStringvalue HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey,
strModeValue3, dwValue
If dwValue <> "" then
WScript.Echo " " & strModeValue3 & ": " & dwValue
End If
Next
'==========================='

"Carlos Felipe França da Fonseca" <car...@felipe.com.br> wrote in message
news:elEzt7zX...@TK2MSFTNGP03.phx.gbl...

0 new messages