GregThompson Posted April 17, 2009 Posted April 17, 2009 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.
zorphnog Posted April 17, 2009 Posted April 17, 2009 $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
weaponx Posted April 17, 2009 Posted April 17, 2009 (edited) 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 April 17, 2009 by weaponx
GregThompson Posted April 17, 2009 Author Posted April 17, 2009 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.
Sayen Posted June 15, 2009 Posted June 15, 2009 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 GregThompsonDid you find something out?I am searching the same thing.
rajeshontheweb Posted June 15, 2009 Posted June 15, 2009 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 Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet
rajeshontheweb Posted June 15, 2009 Posted June 15, 2009 i havent checked fully on the basic differentiation between the two wmi classes but latter doesnt return linkspeed on my pc (windows xp sp3) Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now