rvn Posted September 7, 2009 Share Posted September 7, 2009 i've server-client computers with domain system. But for a reason, i must change gateway for computers. Is there any method that i can use to made it done?! Course with autoit thanx for help Link to comment Share on other sites More sharing options...
99ojo Posted September 7, 2009 Share Posted September 7, 2009 i've server-client computers with domain system. But for a reason, i must change gateway for computers. Is there any method that i can use to made it done?! Course with autoit thanx for help Hi, you may be a lucky guy. Here's a script for changing DNS Server. I think you are clever and you can change it for your needs. Just have a look at helpfile for the functions and in registry of windows. Dim $aInterface [10] $newdns = "192.168.1.1" For $i= 1 to 10 ; Max 10 Interfaces $var = RegEnumKey("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces", $i) If @error <> 0 then ExitLoop $aInterface [$i] = $var Next For $i = 1 To UBound ($aInterface) - 1 If $aInterface [$i] = "" Then ExitLoop If RegRead ("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $aInterface [$i], "NameServer") <> "" Then RegWrite ("HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & $aInterface [$i], "NameServer", "REG_SZ", $newdns) EndIf Next ;-)) Stefan Link to comment Share on other sites More sharing options...
rvn Posted September 7, 2009 Author Share Posted September 7, 2009 oh thanx bro so change it via registry for remote computer right?! ok i'll try it right now Link to comment Share on other sites More sharing options...
omikron48 Posted September 7, 2009 Share Posted September 7, 2009 You can use netsh to change TCP/IP settings. Link to comment Share on other sites More sharing options...
rvn Posted September 7, 2009 Author Share Posted September 7, 2009 the apps done here... the code i've made... thanx to 99ojo for clue 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/Ervan B.S 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) $Group1 = GUICtrlCreateGroup("Computer Target", 8, 0, 249, 41) $Input1 = GUICtrlCreateInput("", 16, 16, 121, 21) $Button1 = GUICtrlCreateButton("Get Remote Interface", 144, 16, 105, 17, $BS_DEFPUSHBUTTON) GUICtrlSetTip(-1, "Get remote interface") GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Interface", 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, 121, 17, 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", "Change Remote Interface - 1.0.0.1 Beta" & @CRLF & "--------------------------------------------------------" & @CRLF & "Simple tool to change remote interface." & @CRLF & "Right privileges needed for full function. " & @CRLF & "@2009 Ervan B.S" & @CRLF & @CRLF) WinSetState($Form1, "", @SW_SHOW) EndFunc ;==>about_ Link to comment Share on other sites More sharing options...
BoogY Posted October 2, 2009 Share Posted October 2, 2009 How can you parse the interfaces so they apear like Local Area Network not like {8F80F371-5111-4A77-B8B5-3F1148C188C0} thanks a lot 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