**DONOTDELETE**
(Lurker)
2001-07-26 12:15 AM
Chaning IP/Mask & Gateway with kix ?

Anyone knows how to change ip / gateway and subnet mask using kix ? Need it to re-config aprox. 500 computers...

**DONOTDELETE**
(Lurker)
2001-07-26 12:31 AM
Re: Chaning IP/Mask & Gateway with kix ?

Hiya
do you need to change to DHCP ?

steve

**DONOTDELETE**
(Lurker)
2001-07-26 12:34 AM
Re: Chaning IP/Mask & Gateway with kix ?

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)

**DONOTDELETE**
(Lurker)
2001-07-26 12:39 AM
Re: Chaning IP/Mask & Gateway with kix ?

one last question ... which OS?

LonkeroAdministrator
(KiX Master Guru)
2001-07-26 12:44 AM
Re: Chaning IP/Mask & Gateway with kix ?

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.

**DONOTDELETE**
(Lurker)
2001-07-26 12:48 AM
Re: Chaning IP/Mask & Gateway with kix ?

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

LonkeroAdministrator
(KiX Master Guru)
2001-07-26 12:59 AM
Re: Chaning IP/Mask & Gateway with kix ?

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.

**DONOTDELETE**
(Lurker)
2001-07-25 01:16 PM
Re: Chaning IP/Mask & Gateway with kix ?

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

LonkeroAdministrator
(KiX Master Guru)
2001-07-25 01:17 PM
Re: Chaning IP/Mask & Gateway with kix ?

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.


**DONOTDELETE**
(Lurker)
2001-07-25 01:20 PM
Re: Chaning IP/Mask & Gateway with kix ?

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

**DONOTDELETE**
(Lurker)
2001-07-25 01:34 PM
Re: Chaning IP/Mask & Gateway with kix ?

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 ?


**DONOTDELETE**
(Lurker)
2001-07-25 01:57 PM
Re: Chaning IP/Mask & Gateway with kix ?

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

LonkeroAdministrator
(KiX Master Guru)
2001-07-25 02:04 PM
Re: Chaning IP/Mask & Gateway with kix ?

I made some code but seems that wizzzard got you to think about dhcp. so you guys keep thinks going, I'll hung up---

**DONOTDELETE**
(Lurker)
2001-07-25 02:08 PM
Re: Chaning IP/Mask & Gateway with kix ?

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

**DONOTDELETE**
(Lurker)
2001-07-25 02:10 PM
Re: Chaning IP/Mask & Gateway with kix ?

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..

**DONOTDELETE**
(Lurker)
2001-07-25 02:12 PM
Re: Chaning IP/Mask & Gateway with kix ?

And yes.. Would be very nice if you could post that code..

LonkeroAdministrator
(KiX Master Guru)
2001-07-25 02:44 PM
Re: Chaning IP/Mask & Gateway with kix ?

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.


**DONOTDELETE**
(Lurker)
2001-07-25 02:50 PM
Re: Chaning IP/Mask & Gateway with kix ?

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 ]

LonkeroAdministrator
(KiX Master Guru)
2001-07-25 03:10 PM
Re: Chaning IP/Mask & Gateway with kix ?

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,

**DONOTDELETE**
(Lurker)
2001-07-25 04:03 PM
Re: Chaning IP/Mask & Gateway with kix ?

Thanx.. Testing so far looks good

**DONOTDELETE**
(Lurker)
2001-07-25 06:06 PM
Re: Chaning IP/Mask & Gateway with kix ?

Hiya
MS DHCP is in use here , just create a new scope but with the default gateway as the new address of the remote router that needs a DHCP address, if you have a static set of addresses assigned to a site you can put those as the scope range ie 10.2.22.0 - 10.2.22.150 this will give you 151 addresses

I will dig out the notes for cisco routers and post or would u prefer email ?

I am located Uk and work for NHS + U ??

**DONOTDELETE**
(Lurker)
2001-07-26 09:18 AM
Re: Chaning IP/Mask & Gateway with kix ?

If you do this and mail it to "toha.no@falck.dk". This is an mail adress in the Group4Falck company in Norway..

Thanks in advance

NTDOCAdministrator
(KiX Master)
2001-07-26 01:33 PM
Re: Chaning IP/Mask & Gateway with kix ?

Lonkero,

Yes, you would probably have to change the Mask as well as maybe the gateway as well at least on some systems, and checking to see about leaving other alone.

Wow can't believe anyone is trying to still use Static IP on that many clients. That is a admin nightmare

Xmine, you really should go with DHCP either built-in or something like QIP

Once up and running it should releive you of many headaches.