Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List Speed & Duplex settings on network adapters using WMI

Status
Not open for further replies.

b82klo

Technical User
Jun 3, 2008
8
NO
Hi,

I am trying to find a way to list Speed & Duplex settings on network adapters on my HP Proliant w2k3 servers using WMI. Possible values could be Auto, 100/Full, 1000/Full, 10/Half and so on.

Anyone that knows how to list this value(s)?

Knut
 
Give this a try

Code:
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter",,48)
For Each objItem in colItems
   
    Wscript.Echo "AutoSense: " & objItem.AutoSense
    Wscript.Echo "Caption: " & objItem.Caption
    Wscript.Echo "Description: " & objItem.Description
    WScript.Echo "MACAddress: " & objItem.MACAddress
    Wscript.Echo "MaxSpeed: " & objItem.MaxSpeed
    Wscript.Echo "Name: " & objItem.Name
    WScript.Echo "PowerManagementSupported: " & objItem.PowerManagementSupported
    WScript.Echo "Speed: " & objItem.Speed
Next

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Mark,
Running your script (I modified it a bit to get only one network adapter, and not all the adapters on my computer) gives me the following output:

AutoSense:
Caption: [00000001] Broadcom NetXtreme Gigabit Ethernet
Description: Broadcom NetXtreme Gigabit Ethernet
MACAddress: 00:17:08:43:07:61
MaxSpeed:
Name: Broadcom NetXtreme Gigabit Ethernet
PowerManagementSupported: False
Speed:

When I run your script on one of my servers I get the same result. It seems that the speed/duplex settings are missing.

A colleague of mine pointed me in the following direction:

Duplex mode:
Code:
strComputer = "." 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\WMI") 
Set colItems = objWMIService.ExecQuery("SELECT * FROM MSNdis_MacOptions",,48) 
For Each objItem in colItems 
    Wscript.Echo "InstanceName: " & objItem.InstanceName
    Wscript.Echo "NdisMacOptions: " & objItem.NdisMacOptions
    Wscript.Echo " "
Next

and

Link speed:
Code:
strComputer = "." 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\WMI") 
Set colItems = objWMIService.ExecQuery("SELECT * FROM MSNdis_LinkSpeed",,48) 
For Each objItem in colItems 
    Wscript.Echo "InstanceName: " & objItem.InstanceName
    Wscript.Echo "NdisLinkSpeed: " & objItem.NdisLinkSpeed/10 & " kbps"
    Wscript.Echo " "
Next

I am having a hard time trying to decode the output from NdisMacOptions. I also do not know if the setting on the network adapter is set to Auto or to a fixed speed/duplex.

Any ideas?

Knut
 
Sorry, no. It seems that some cards react differently to the original code I posted. Mine gives the speed but not the autosense value.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top