Jump to content
Sign in to follow this  

Witch network device is connected?

Recommended Posts

I need to make a script that tells me witch device is connected to the internet, wireless or lan (no loopback interface)

I've searched the forum and autoit help but i can't get anywhere ;)

I just want to popup a little msg that tells me i'm connected to a wireless network or to a lan network. Or simply to witch device ID i'm connected.

Any suggestions please?

Share this post

Link to post
Share on other sites

You can use WMI to list network adapters which have a connection:

;Coded by UEZ 2009

Global $ip = "localhost"
If $CmdLine[0] > 0 Then $ip = $CmdLine[1]

$objWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & $ip & "\root\cimv2")

MsgBox(0, "Network Adapter Configuration", "Network Adapter(s) which have connection(s): " & @CRLF & @CRLF & GetWMI($ip))

Func GetWMI($srv)
    Local $Description, $colItems, $colItem, $ping, $x
    $ping = Ping($srv)
    If $ping Then
        $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True", "WQL", 0x30)
        If IsObj($colItems) Then
            For $objItem In $colItems
                $Description &= $objItem.Description & @CRLF
            Return $Description
            Return "Error!"
        Return "Host not reachable"



Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post

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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...