BoogY Posted October 2, 2009 Posted October 2, 2009 Hi there ... i found this script on the forum : expandcollapse popup#NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\..\icon\Cow.ico #AutoIt3Wrapper_Res_Comment=Beta Version! #AutoIt3Wrapper_Res_Description=Simple tool for manage remote interface #AutoIt3Wrapper_Res_Fileversion=1.0.0.1 #AutoIt3Wrapper_Res_LegalCopyright=@2009 Ervan B.S #AutoIt3Wrapper_Run_Tidy=y #AutoIt3Wrapper_Run_Obfuscator=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: rvn/Bogdan NICORICI Script Function: change_remote_gateway #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $ipTarget, $aInterface[10], $i, $var, $interfaceTarget #Region ### START Koda GUI section ### Form=D:\ra\script\ChangeRemoteInterface.kxf ;~ $Form1 = GUICreate("Change Remote Interface - 1.0.0.1 Beta", 263, 249, -1, -1) $Form1 = GUICreate("CRemote Interface - 1.0.0.1 Beta", 300, 249, -1, -1) $Group1 = GUICtrlCreateGroup("TFS Target", 8, 0, 249, 41) $Input1 = GUICtrlCreateInput("", 16, 16, 121, 21) $Button1 = GUICtrlCreateButton("Get Remote Interface", 144, 16, 112, 20, $BS_DEFPUSHBUTTON) GUICtrlSetTip(-1, "Get remote interface") GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Interfaces", 8, 40, 249, 41) $Combo1 = GUICtrlCreateCombo("", 16, 56, 233, 25) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group3 = GUICtrlCreateGroup("Interface's Values", 8, 80, 249, 161) $Label1 = GUICtrlCreateLabel("IP Address", 16, 96, 55, 17) $Input2 = GUICtrlCreateInput("", 112, 96, 121, 21) $Label2 = GUICtrlCreateLabel("Subnet Mask", 16, 120, 67, 17) $Input3 = GUICtrlCreateInput("", 112, 120, 121, 21) $Label3 = GUICtrlCreateLabel("Default Gateway", 16, 144, 83, 17) $Input4 = GUICtrlCreateInput("", 112, 144, 121, 21) $Label4 = GUICtrlCreateLabel("DNS", 16, 168, 27, 17) $Input5 = GUICtrlCreateInput("", 112, 168, 121, 21) $Button2 = GUICtrlCreateButton("Update Values", 112, 200, 122, 20, 0) $Button3 = GUICtrlCreateButton("?", 16, 216, 17, 17, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 get_interface_() Case $Button2 update_interface_() Case $Button3 about_() Case $Combo1 get_interface_value() EndSwitch WEnd Func get_interface_value() $interfaceTarget = GUICtrlRead($Combo1) ;MsgBox(262144,"$interfaceTarget",$interfaceTarget) GUICtrlSetData($Input2, "") GUICtrlSetData($Input3, "") GUICtrlSetData($Input4, "") GUICtrlSetData($Input5, "") $ip_ = RegRead("\\" & $ipTarget & "\HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $interfaceTarget, "IPAddress") $subnet_ = RegRead("\\" & $ipTarget & "\HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $interfaceTarget, "SubnetMask") $gateway_ = RegRead("\\" & $ipTarget & "\HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $interfaceTarget, "DefaultGateway") $dns_ = RegRead("\\" & $ipTarget & "\HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $interfaceTarget, "NameServer") GUICtrlSetData($Input2, $ip_) GUICtrlSetData($Input3, $subnet_) GUICtrlSetData($Input4, $gateway_) GUICtrlSetData($Input5, $dns_) EndFunc ;==>get_interface_value Func get_interface_() $ipTarget = GUICtrlRead($Input1) ;MsgBox(262144,$ipTarget,$ipTarget) If $ipTarget = "" Then Return "" GUICtrlSetData($Combo1, "") For $i = 1 To 10 ; Max 10 Interfaces ;MsgBox(262144,$i,"") $var = RegEnumKey("\\" & $ipTarget & "\HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces", $i) If @error Then ;MsgBox(262144,"Error","Error found when getting interface!") ;ExitLoop Return "" Else $aInterface[$i] = $var ;MsgBox(0,"",$aInterface [$i]) GUICtrlSetData($Combo1, $var, $var) EndIf Next EndFunc ;==>get_interface_ Func update_interface_() If $ipTarget = "" Then Return "" If $interfaceTarget = "" Then Return "" RegWrite("\\" & $ipTarget & "\HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $interfaceTarget, "IPAddress", "REG_MULTI_SZ", GUICtrlRead($Input2)) RegWrite("\\" & $ipTarget & "\HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $interfaceTarget, "SubnetMask", "REG_MULTI_SZ", GUICtrlRead($Input3)) RegWrite("\\" & $ipTarget & "\HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $interfaceTarget, "DefaultGateway", "REG_MULTI_SZ", GUICtrlRead($Input4)) RegWrite("\\" & $ipTarget & "\HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $interfaceTarget, "NameServer", "REG_MULTI_SZ", GUICtrlRead($Input5)) MsgBox(262144, "Updated!", "Updated value to remote server... done!") get_interface_value() EndFunc ;==>update_interface_ Func about_() WinSetState($Form1, "", @SW_HIDE) MsgBox(262208, "About - Change Remote Interface - 1.0.0.1 Beta") WinSetState($Form1, "", @SW_SHOW) EndFunc ;==>about_ but i want to be able to get the Network adapter like (Local Network Area) not like {95E7D8F8-BF3C-4C05-8444-ED20E6B796C6} HOW IS THAT POSSIBLE ? Thanks a lot
exodius Posted October 4, 2009 Posted October 4, 2009 According to this page, you can correlate the ID to it's "friendly-name" by looking in the registry here:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\<ID for Adapter>\Connection
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