rajeshontheweb Posted May 5, 2009 Posted May 5, 2009 just was working on somethingelse, stumbled upon an efficient way of getting all Local adapter IP Addresses :-) donno if @IPAddress1 , etc returns the same thing but Object Error handling is to be added to my script i will do it later expandcollapse popup#include <Array.au3> #cs ; Example $IPAddresses = _GetLocalIPAddress_WMI() _ArrayDisplay($IPAddresses, "LocalIPAddressListing") #ce ; #FUNCTION# ;=============================================================================== ; ; Name...........: __GetLocalIPAddress_WMI ; Description ...: Returns an array of IP Addresses as available from all Local NetworkAdapters installed ; Syntax.........: _GetLocalIPAddress_WMI() ; Parameters ....: None Defined ; Return values .: Success - Array Containing the IP Addresses ; Failure - Returns 0 and Sets @Error to Error returned by WMI Object ; Author ........: Rajesh V R ; Version .......; 1.0 ; Modified.......: 05 May 2009 ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; Yes ; ; ;========================================================================================== Func _GetLocalIPAddress_WMI() Local $retArray[1] Local $objWMIService = ObjGet("winmgmts:\\.\root\CIMV2") Local $IPConfigSet = $objWMIService.ExecQuery("Select IPAddress from Win32_NetworkAdapterConfiguration ") For $IPConfig In $IPConfigSet $array = $IPConfig.IPAddress If IsArray($array) Then For $i = 0 To UBound($array) - 1 _ArrayAdd($retArray, $array[$i]) Next EndIf Next Return $retArray EndFunc ;==>_GetLocalIPAddress_WMI 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