pintas Posted October 18, 2010 Share Posted October 18, 2010 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? Link to comment Share on other sites More sharing options...
UEZ Posted October 18, 2010 Share Posted October 18, 2010 You can use WMI to list network adapters which have a connection: ;Coded by UEZ 2009 #AutoIt3Wrapper_Change2CUI=y #AutoIt3Wrapper_UseUpx=n 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 Next SetError(0) Return $Description Else SetError(1) Return "Error!" EndIf Else SetError(1) Return "Host not reachable" EndIf EndFunc Br, UEZ 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
pintas Posted October 19, 2010 Author Share Posted October 19, 2010 Very very nice. Exactly what i was looking for. Thank you UEZ! Link to comment Share on other sites More sharing options...
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