#10827 - 2001-07-26 12:15 AM
Chaning IP/Mask & Gateway with kix ?
|
Anonymous
Anonymous
Unregistered
|
Anyone knows how to change ip / gateway and subnet mask using kix ? Need it to re-config aprox. 500 computers...
|
Top
|
|
|
|
#10828 - 2001-07-26 12:31 AM
Re: Chaning IP/Mask & Gateway with kix ?
|
Anonymous
Anonymous
Unregistered
|
Hiya do you need to change to DHCP ?steve
|
Top
|
|
|
|
#10829 - 2001-07-26 12:34 AM
Re: Chaning IP/Mask & Gateway with kix ?
|
Anonymous
Anonymous
Unregistered
|
Nop.. I need to change to another static ip I primarly need to know where / how to write the values to registry / find the active NIC (since the computers runs different nic's)
|
Top
|
|
|
|
#10830 - 2001-07-26 12:39 AM
Re: Chaning IP/Mask & Gateway with kix ?
|
Anonymous
Anonymous
Unregistered
|
one last question ... which OS?
|
Top
|
|
|
|
#10832 - 2001-07-26 12:48 AM
Re: Chaning IP/Mask & Gateway with kix ?
|
Anonymous
Anonymous
Unregistered
|
Hiya, This is the code I have used in the past, unfortunately I cannot claim the credit for writing it , but like everything else..... share and share alike best of luck
steve ;----------------------------------------------------- ; File - DHCP95.Kix ; Logic - Change Workstation to DHCP ; Changes - 6/8/99 (hef) Created ; 6/9/99 (jmb) Added multiple NIC Support $ComputerName=ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName","ComputerName") $HKLM = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services" $Index = 0 $Reboot = "NO" :Loop1 $KeyName = ENUMKEY( "$HKLM\Class\NetTrans\" , $Index ) $RC = @ERROR $DHCPEnabled=ReadValue("$HKLM\Class\NetTrans\$KeyName","IPAddress") $Index = $Index + 1 If $RC = 0 If $DHCPEnabled <> "0.0.0.0" $Reboot = "YES" ;--------------------------------------------------- ;Updating to DHCP... ;--------------------------------------------------- ; Set DHCP Settings $ReturnCode = WRITEVALUE( "$HKLM\Class\NetTrans\$KeyName" , "IPAddress" , "0.0.0.0" , "REG_SZ") $ReturnCode = WRITEVALUE( "$HKLM\Class\NetTrans\$KeyName" , "IPMask" , "0.0.0.0" , "REG_SZ") $ReturnCode = DELVALUE( "$HKLM\Class\NetTrans\$KeyName" , "DefaultGateway") ;--------------------------------------------------- ; Clear WINS, DNS, and check Enable DNS Windows Resolution in WINS ;--------------------------------------------------- $ReturnCode = WRITEVALUE( "$HKLM\VxD\MSTCP" , "EnableDNS" , "0" , "REG_SZ") $ReturnCode = DELVALUE( "$HKLM\VxD\MSTCP" , "NameServer") $ReturnCode = DELVALUE( "$HKLM\VxD\MSTCP" , "NameServer1") $ReturnCode = DELVALUE( "$HKLM\VxD\MSTCP" , "NameServer2") $ReturnCode = DELVALUE( "$HKLM\VxD\MSTCP" , "SearchList") $ReturnCode = DELVALUE( "$HKLM\VxD\MSTCP" , "Domain") $ReturnCode = DELVALUE( "$HKLM\VxD\MSTCP" , "NodeType") $ReturnCode = DELVALUE( "$HKLM\VxD\MSTCP" , "ScopeID") Endif goto Loop1 Endif
|
Top
|
|
|
|
#10834 - 2001-07-25 01:16 PM
Re: Chaning IP/Mask & Gateway with kix ?
|
Anonymous
Anonymous
Unregistered
|
Ok.. Case is like this.. I have aprox. 40 different sites all over the country.. All with their own ip-range. They should then change to a new ip-range. One range at each location. In total it's about 500 machines. Some of the locations uses dhcp and here it's no problem, but most of the locations are to small to put a dhcp server into..OS = Win 98
|
Top
|
|
|
|
#10836 - 2001-07-25 01:20 PM
Re: Chaning IP/Mask & Gateway with kix ?
|
Anonymous
Anonymous
Unregistered
|
We have similar situation here but are using remote DHCP servers all that needs to be done is that each remote site has its own DHCP scope on your main server . Depends on length of lease it wont put any additional load on yr networkSteve
|
Top
|
|
|
|
#10837 - 2001-07-25 01:34 PM
Re: Chaning IP/Mask & Gateway with kix ?
|
Anonymous
Anonymous
Unregistered
|
Sounds great... But how do you make the clients look for a remote dhcp server ? Do you have to make a broadcast all over the network all the time, or can you make the client go looking over a wan ?
|
Top
|
|
|
|
#10838 - 2001-07-25 01:57 PM
Re: Chaning IP/Mask & Gateway with kix ?
|
Anonymous
Anonymous
Unregistered
|
If you want to set private addressing 10.0.0.0 network for instance, assign another IP to the router , say 10.2.20.250 make this the primary route , with the original as secondary, make sure that the range is set up on both ends and allowed via the firewall. Next create the scope using remote route IP as default gateway for that scope .... roberts' your mothers brother as the saying goes. what routers are you using ? I may be able to forward info on settings, we use 3com and cisco here Steve
|
Top
|
|
|
|
#10840 - 2001-07-25 02:08 PM
Re: Chaning IP/Mask & Gateway with kix ?
|
Anonymous
Anonymous
Unregistered
|
Thanks for being there ... dont go too far can you post the code anyway just in case this is not the route to go ?Steve
|
Top
|
|
|
|
#10841 - 2001-07-25 02:10 PM
Re: Chaning IP/Mask & Gateway with kix ?
|
Anonymous
Anonymous
Unregistered
|
Ok.. I did get the part with routers.. We are primarly using Cisco and IBM all over the wan.. Any help would be fine What goes for the dhcp scope i'm still a little lost.. Which dhcp server do you use ? We have MS Dhcp on the pdc / bdc, but i cant really understand how i should configure this scope..
|
Top
|
|
|
|
#10842 - 2001-07-25 02:12 PM
Re: Chaning IP/Mask & Gateway with kix ?
|
Anonymous
Anonymous
Unregistered
|
And yes.. Would be very nice if you could post that code..
|
Top
|
|
|
|
#10844 - 2001-07-25 02:50 PM
Re: Chaning IP/Mask & Gateway with kix ?
|
Anonymous
Anonymous
Unregistered
|
Well.. If i can change from aaa.bbb.ccc.DDD to hhh.iii.jjj.DDD (as you say, the last part stays) it would do the trick..[ 25 July 2001: Message edited by: Xmine ]
|
Top
|
|
|
|
#10845 - 2001-07-25 03:10 PM
Re: Chaning IP/Mask & Gateway with kix ?
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
okey.... here is the code. it changes just ip. prob the mask has to be changed too. well, didn't test it, because only win98 machine I've found so far is one of the big boss'es and I don't dare to mess with them code:
if 0 = exist("%temp%\ipchanged.tmp") $baseip = "10.10.10" $curip = @ipaddress $newip = $baseip + "."+val(substr($curip,12,3)) $bkey = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services" $c = 0 $Reboot = 0 $KeyN = enumkey("$bkey\Class\NetTrans\",$c) while @error = 0 $ip = ReadValue($bkey+"\Class\NetTrans\$KeyN","IPAddress") if @error = 0 and $ip <> "0.0.0.0" $ = writevalue($bkey+"\Class\NetTrans\$KeyN","IPAddress",$newip,"REG_SZ") $Reboot = 1 endif $c = $c +1 $KeyN = enumkey($bkey+"\Class\NetTrans\",$c) loop if $Reboot = 1 shell "%comspec% /c echo changed ip from $curip to $newip > %temp%\changed.tmp" ? "System needs to be restarted to establish new settings." ? ? " Press any key to proceed..." get $ run “%windir%\RUNDLL32.EXE user.exe,ExitWindows” exit else shell "%comspec% /c echo no changes done, current-ip $curip > %temp%\changed.tmp" endif endif
so. it checks if it is ran on the machine before and does not run second time. it also changes the ip, if it is existent. it is also only for win98 machines, which means more testing on 95 and definetely not use it on winNT/2000 it can be checked by the kix macro @inwin: if @inwin = 2 execute endifcheers,
_________________________
!download KiXnet
|
Top
|
|
|
|
#10846 - 2001-07-25 04:03 PM
Re: Chaning IP/Mask & Gateway with kix ?
|
Anonymous
Anonymous
Unregistered
|
Thanx.. Testing so far looks good
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 163 anonymous users online.
|
|
|