Jump to content
Sign in to follow this  
GregThompson

Network Link Speed

Recommended Posts

GregThompson

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.

Share this post


Link to post
Share on other sites
zorphnog

$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

Share this post


Link to post
Share on other sites
weaponx

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

Share this post


Link to post
Share on other sites
GregThompson

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

Share this post


Link to post
Share on other sites
Sayen

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.

Share this post


Link to post
Share on other sites
rajeshontheweb

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

Share this post


Link to post
Share on other sites
rajeshontheweb

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.