Page 1 of 2 12>
Topic Options
#10827 - 2001-07-26 12:15 AM Chaning IP/Mask & Gateway with kix ?
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
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
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
Unregistered


one last question ... which OS?
Top
#10831 - 2001-07-26 12:44 AM Re: Chaning IP/Mask & Gateway with kix ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
heh. sorry, shouldn't be too happy on others problems, but if you have to do this now, you prob. have to do it again and maybe on 1000 machines!
on some REEEALLY wide wan I might understand not wanting to start changing to dhcp, but with 500 machines it is what should turned on imeadatly. well...
will look at that.

and wizzard, if you have some code for dhcp, post it here. could be usefull.

_________________________
!

download KiXnet

Top
#10832 - 2001-07-26 12:48 AM Re: Chaning IP/Mask & Gateway with kix ?
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
#10833 - 2001-07-26 12:59 AM Re: Chaning IP/Mask & Gateway with kix ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ok, thanks.
I'll check and change the code to apply to ip change.
I'll do the change to be as remotescript, 'cause normal user does not have admin rights.
this offcourse means that you need to have nt/2000 clients.

do you have some specific ip class to change? like 10.123.131.*???
or do you want to change many classes to one/many? then it might be easier to scan by domain...

please reply asap.

_________________________
!

download KiXnet

Top
#10834 - 2001-07-25 01:16 PM Re: Chaning IP/Mask & Gateway with kix ?
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
#10835 - 2001-07-25 01:17 PM Re: Chaning IP/Mask & Gateway with kix ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I found out that this script ain't working ???
it hacks to reg the places where ain't keys, like "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Class\NetTrans\"
there is no class.
but will check my inventory script for these keys and functions.
hopefully reply today.
_________________________
!

download KiXnet

Top
#10836 - 2001-07-25 01:20 PM Re: Chaning IP/Mask & Gateway with kix ?
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 network

Steve

Top
#10837 - 2001-07-25 01:34 PM Re: Chaning IP/Mask & Gateway with kix ?
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
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
#10839 - 2001-07-25 02:04 PM Re: Chaning IP/Mask & Gateway with kix ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I made some code but seems that wizzzard got you to think about dhcp. so you guys keep thinks going, I'll hung up---
_________________________
!

download KiXnet

Top
#10840 - 2001-07-25 02:08 PM Re: Chaning IP/Mask & Gateway with kix ?
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
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
Unregistered


And yes.. Would be very nice if you could post that code..
Top
#10843 - 2001-07-25 02:44 PM Re: Chaning IP/Mask & Gateway with kix ?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ok. then I need to know... well, how huge part of your ip's are going to change or are you keeping anything.
like is there going to be that daa.daa.daa.xxx changes to dai.dal.duu.xxx where xxx remains the same
or
daa.daa.daa.die changes to dai.dal.duu.duy where everything changes?
I'll put the code here with the assumption, that the last part does not change.
_________________________
!

download KiXnet

Top
#10844 - 2001-07-25 02:50 PM Re: Chaning IP/Mask & Gateway with kix ?
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 Administrator Offline
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
endif

cheers,

_________________________
!

download KiXnet

Top
#10846 - 2001-07-25 04:03 PM Re: Chaning IP/Mask & Gateway with kix ?
Anonymous
Unregistered


Thanx.. Testing so far looks good
Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 163 anonymous users online.
Newest Members
SERoyalty, mytar, Gabriel, Alex_Evos, Dansen
17869 Registered Users

Generated in 0.065 seconds in which 0.025 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org