Jump to content

check lan speed


Recommended Posts

Hi all,

I've one project that need to be helped. i'm newbie too, so that i dont know what to be start.

My project is check mainboard LAN speed is 100 or 1000Mbps.

In cmd i know an command that show exactly the speed, but dont know to use at autoit

the command is: "ping 192.168.1.1 -n 1 -l 65500"

when computer reply in time >=10ms then speed is 100Mbps, else reply time is 1,2 or 3ms then speed is 1000Mbps

The question is how to use this command to check that in autoit then show to gui

Or someone know the otherway to check that, please help me

So many thank for all although you can help or not!

Sorry for my bad english ^_^

Link to comment
Share on other sites

you can run that command and get the info, look at STDOutRead in help file.

WMI will also have that information on network interface speed, but im lousy with that, search "wmi network interface info" on web.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

you can run that command and get the info, look at STDOutRead in help file.

WMI will also have that information on network interface speed, but im lousy with that, search "wmi network interface info" on web.

can you suggest me the code! it's very hard with an newbie like me, thank you

Edited by bootlesnet
Link to comment
Share on other sites

I already suggested code "StdoutRead"

Here is basic example, try to search how to get the info you want, from the string variable.

$PID = Run(@ComSpec & " /c ping localhost -n 1 -l 65500", @WorkingDir, @SW_HIDE, 2)

While ProcessExists($PID)
    ;nothing
WEnd

$StringInfoFromCommandPromptWindow = StdoutRead($PID)

MsgBox(0,0, $StringInfoFromCommandPromptWindow)

 

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

  • Moderators

You could also use WMI:

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20

$oWMI = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2")
$oItems = $oWMI.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    If IsObj($oItems) then
        For $oAdapter In $oItems
            ConsoleWrite($oAdapter.Name & " Speed: " & $oAdapter.Speed & @CRLF)
        Next
    Else
        Msgbox(0,"Error","No WMI Objects Found for class: Win32_NetworkAdapter")
    Endif

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

I already suggested code "StdoutRead"

Here is basic example, try to search how to get the info you want, from the string variable.

$PID = Run(@ComSpec & " /c ping localhost -n 1 -l 65500", @WorkingDir, @SW_HIDE, 2)

While ProcessExists($PID)
    ;nothing
WEnd

$StringInfoFromCommandPromptWindow = StdoutRead($PID)

MsgBox(0,0, $StringInfoFromCommandPromptWindow)

 

when i run this it's pending forever, why?

You could also use WMI:

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20

$oWMI = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2")
$oItems = $oWMI.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    If IsObj($oItems) then
        For $oAdapter In $oItems
            ConsoleWrite($oAdapter.Name & " Speed: " & $oAdapter.Speed & @CRLF)
        Next
    Else
        Msgbox(0,"Error","No WMI Objects Found for class: Win32_NetworkAdapter")
    Endif

 

this code is work but so many result, how to write this result to text,

thank you two for help!!!

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...