Quote
Quote
Quote
How can we add "Obtain IP Address Automatically" and show in the message box right above "Obtain DNS Server Automatically"?
Is this what you were looking for? >>
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <Array.au3> Global $aArray = _IPDetails(), $sData _ArrayDisplay($aArray) For $A = 1 To $aArray[0][0] $sData &= "Description: " & $aArray[$A][0] & @CRLF & "IP Address: " & $aArray[$A][1] & @CRLF & "MAC: " & $aArray[$A][2] & _ @CRLF & "Default Gateway: " & $aArray[$A][3] & @CRLF & "DNS Servers: " & $aArray[$A][4] & @CRLF & "Obtain DNS Automatically: " & $aArray[$A][5] & _ @CRLF & "Auto IP: " & $aArray[$A][6] & @CRLF & @CRLF Next $sData = StringTrimRight($sData, 4) MsgBox(0, "_IPDetails()", $sData) Func _IPDetails() Local $iCount = 0 Local $oWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2") Local $oColItems = $oWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True", "WQL", 0x30), $aReturn[1][7] = [[0, 7]] If IsObj($oColItems) Then For $oObjectItem In $oColItems $aReturn[0][0] += 1 $iCount += 1 If $aReturn[0][0] <= $iCount + 1 Then ReDim $aReturn[$aReturn[0][0] * 2][$aReturn[0][1]] EndIf $aReturn[$iCount][0] = _IsString($oObjectItem.Description) $aReturn[$iCount][1] = _IsString($oObjectItem.IPAddress(0)) $aReturn[$iCount][2] = _IsString($oObjectItem.MACAddress) $aReturn[$iCount][3] = _IsString($oObjectItem.DefaultIPGateway(0)) $aReturn[$iCount][4] = _WMIArrayToString($oObjectItem.DNSServerSearchOrder(), " - ") ; You could use _ArrayToString() but I like creating my own Functions especially when I don't need alot of error checking. $aReturn[$iCount][5] = _WMIRegRead($oObjectItem.SettingID) $aReturn[$iCount][6] = _IsString($oObjectItem.DHCPEnabled) Next ReDim $aReturn[$aReturn[0][0] + 1][$aReturn[0][1]] Return $aReturn EndIf Return SetError(1, 0, $aReturn) EndFunc ;==>_IPDetails Func _WMIRegRead($iGUID) If RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $iGUID & "\", "NameServer") = "" Then Return True EndIf Return False EndFunc ;==>_WMIRegRead Func _IsString($sString) If IsString($sString) Or IsBool($sString) Then Return $sString EndIf Return "Not Available" EndFunc ;==>_IsString Func _WMIArrayToString($aArray, $sDelimeter = "|") If IsArray($aArray) = 0 Then Return SetError(1, 0, "Not Available") EndIf Local $iUbound = UBound($aArray) - 1, $sString For $A = 0 To $iUbound $sString &= $aArray[$A] & $sDelimeter Next Return StringTrimRight($sString, StringLen($sDelimeter)) EndFunc ;==>_WMIArrayToString














