Jump to content

Network Link Speed


Recommended Posts

This has been brought up quite a few times it seems, with no real answer, yet I know it's possible.

I need a way to show the currently set Link Speed set on any active NICs on a machine. I know it's possible because PENetCFG can do it, but I need it done from more of a command line, as well as reporting on it. The PENetCFG utility otherwise, is a perfect example of what I'm looking for. When you open it, it shows the active NICs, and the LinkSpeed/Duplex Mode. I don't need to necessarily SET the Speed/Mode, but it would be nice.

Anyone know of anything for this in the manner in which I'm speaking? He must be using WMI for it, but I can't tell HOW he's doing it.

Link to comment
Share on other sites

$oWMI = ObjGet("winmgmts:\\.\root\CIMV2")
If Not @error Then
    $cAdapters = $oWMI.ExecQuery('SELECT * FROM Win32_NetworkAdapter')
    If Not @error Then
        For $oAdapter In $cAdapters
            ConsoleWrite("Description: " & $oAdapter.Description & @LF)
            ConsoleWrite("Speed:       " & $oAdapter.Speed & " bps" & @LF)       ;Speed in bits per second
            ConsoleWrite(@LF)
        Next
    EndIf
EndIf

Link to comment
Share on other sites

Code and junk

These are always blank for me. For others as well.

http://www.vistax64.com/powershell/79129-w...pter-speed.html

This might help:

$strServer = "."

$objWMI = ObjGet("winmgmts://" & $strServer & "/root\WMI")
$objInstances = $objWMI.InstancesOf("MSNdis_LinkSpeed",48)

For $objInstance in $objInstances
    With $objInstance
        ;ConsoleWrite( .Active & @CRLF)
        ConsoleWrite( .InstanceName & @CRLF)
        ConsoleWrite( .NdisLinkSpeed & @CRLF)
    EndWith
Next
Edited by weaponx
Link to comment
Share on other sites

Zorph / Weapon...

Thanks for the fast reply, however I've tried both of those. Zorphs is all blank, and Weapon that one returns possible speeds, but not current Speed/Duplex setting. Here's a screenshot of PENetCFG and the options for an Active NIC. As you can see, it shows all the options, in plain english, and the current is at the top of the list. I can change it in this program, hit apply/ok and it updates the selected NIC settings without having to restart. Ideally... this is what I'm looking to do, via command line, but also report on it. So, to say, hey adapter 1 is set to Auto, without having to change it right away, and I can come back to it later. Basically... read the current settings in plain english just like this app.

post-4488-1239992362_thumb.jpg

Link to comment
Share on other sites

  • 1 month later...

Zorph / Weapon...

Thanks for the fast reply, however I've tried both of those. Zorphs is all blank, and Weapon that one returns possible speeds, but not current Speed/Duplex setting. Here's a screenshot of PENetCFG and the options for an Active NIC. As you can see, it shows all the options, in plain english, and the current is at the top of the list. I can change it in this program, hit apply/ok and it updates the selected NIC settings without having to restart. Ideally... this is what I'm looking to do, via command line, but also report on it. So, to say, hey adapter 1 is set to Auto, without having to change it right away, and I can come back to it later. Basically... read the current settings in plain english just like this app.

Hi GregThompson

Did you find something out?

I am searching the same thing.

Link to comment
Share on other sites

does wmi work in your pcs (ie., other wmi calls work? ) then please try this

$strServer = "."

$objWMI = ObjGet("winmgmts://" & $strServer & "/root\WMI")
$objInstances = $objWMI.InstancesOf("MSNdis_CoLinkSpeed",48)

For $objInstance in $objInstances
    With $objInstance
       ;ConsoleWrite( .Active & @CRLF)
        ConsoleWrite( .InstanceName & @CRLF)
        ConsoleWrite( .NdisCoLinkSpeed & @CRLF)
    EndWith
Next
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...