Page 1 of 1 1
Topic Options
#63356 - 2002-02-24 09:24 PM how to change IP Address
jpratheesh Offline
Fresh Scripter

Registered: 2002-01-24
Posts: 5
Loc: UAE
Dear Friends,
I have some doubts in the following area,
The thing is that i have an instance of
Windows 2000 Server and an instance of
Windows NT4 Server in a machine. I have
given static IP address to this machine. I
want to know whether i can change the IP
Address of this machine. If it is posssible
where should i make the changes, so that if
i ping the machine from another machine with
the new IP Address, it must give a
successful ping. I changed the registry key
HKLM\SYSTEM\CurrentControlSet\Services\%
ServiceName%\Parameters\TCPIP
but it didn't work. The thing is that even
after restarting the machine, the commmand
IPCONFIG returned the older value for the IP
Address. I hope that somebody can help me to
solve this problem
thanking you,
J.Pratheesh

Top
#63357 - 2002-02-25 06:19 PM Re: how to change IP Address
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
jpratheesh -
Yes, you can change the IP. But why are you hacking the registry for this? Since this will apparently be a one-time change, why not simply perform from the Control Panel Network applet under both operating systems on the one machine? Or, if you have a DHCP Server, allocate the specific IP address you want to this machine, regardless of O/S, using the MAC address of the NIC? This will help in the future because any changes to the server IP will be handled by DHCP Manager, not visiting the server.

Bill

** Lucky post 500 - thanks to everyone on the board for tolerating my information, mis-information, mis-spellings and other assorted misdemeanors. And to our friends to the North, who swept the Gold in Hockey from the U.S, yet another reason to invade and make you our 51st state!!! **

[ 25 February 2002: Message edited by: bleonard ]

Top
#63358 - 2002-02-27 10:44 AM Re: how to change IP Address
lpuyod Offline
Fresh Scripter

Registered: 2002-02-05
Posts: 9
Loc: Philippines
) Lpuyod is the best
You can use NewIP to change Static Ipaddress only for Win2k only .This will not work on Winnt.

newip \\computername a.b.c.d

where a.b.c.d is the new ipaddress

tested to work under win2x
BoYET

Top
#63359 - 2002-02-27 01:13 PM Re: how to change IP Address
jpratheesh Offline
Fresh Scripter

Registered: 2002-01-24
Posts: 5
Loc: UAE
Dear Friend,
I was not able to find the command NewIP which u mentioned in Windows 2000 Server.
Have u chaecked it or in which version do u have this command.
thanking u,
Pratheesh

Top
#63360 - 2002-02-27 03:42 PM Re: how to change IP Address
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Now Now, Bill... You had to paint the Whitehouse once already...
Congratulations on your 500th!
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#63361 - 2002-02-27 04:21 PM Re: how to change IP Address
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
If I remember correctly, you must change the IP address in all locations in the registry (read: there is more than one location). You should do a full registry search to see where the IP address shows up. It is not an easy feat. And even if you replace the IP address you will still have to reboot the computer the the change to take effect.
Alternatively, get the program 'Advanced Registry Tracer', get the baseline registry, make the IP address change, DO NOT REBOOT, run 'Advanced Registry Tracer' again, and compare the two registry file. 'Advanced Registry Tracer' will list every registry key that has been added, deleted, or changed. Then you should be able to find out which regitry keys you will have to change in order to update the IP address.
_________________________
There are two types of vessels, submarines and targets.

Top
#63362 - 2002-02-28 03:02 AM Re: how to change IP Address
lpuyod Offline
Fresh Scripter

Registered: 2002-02-05
Posts: 9
Loc: Philippines
It Really works on Win2k Changing IP address.. We just make this program work in our organization.. You can make your own one
by using NetSh
try the help files of netsh..

Too bad my they don't have Standard IPaddressing Scheme...

Cheers,
Boyet

Top
#63363 - 2002-02-28 04:01 AM Re: how to change IP Address
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
A man of few words...

Take a look at How to Use the NETSH Command to Change from Static IP Address to DHCP in Windows 2000 (Q257748)

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#63364 - 2002-03-04 04:21 PM Re: how to change IP Address
Javier Sanchez Offline
Fresh Scripter

Registered: 2002-02-01
Posts: 14
Loc: Barcelona
If your modify This source code, your problem is solvented.

Regards... Javier Sanchez

code:
  
;----------------------------------------------------------------------
; Script by Javier Sanchez Alcazar
; js.alcazar@terra.es
;Please, if your use the script send me one E-Mail. Thanks
;----------------------------------------------------------------------
;
; Revisión : 1.01
; Date: 3-4-2002
;
;---------------------------------------------------------------------------
; Runing process with: Kix32 DHCPScript.txt
;----------------------------------------------------------------------------------
;----------------------------------------
; Registry Key
;----------------------------------------
$REG1="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\"
$REG2="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\"
$C1="Parameters"
$C2="Tcpip"
$SubCadena=$C1+"\"+$C2

;----------------------------------------------------
; Line to modify
;----------------------------------------------------
$IPAddress="0.0.0.0"
$IPMask="0.0.0.0"
$IPValue=""

;---------------------------------
;Directory definition
;---------------------------------
$Backup="C:\BackupDHCP\"

;-----------------------------------------
;ASCII Char
;-----------------------------------------
$CR=chr(13)
$LF=crh(10)

;---------------------------------
;Var
;---------------------------------
$RCode=""
$Contador=0
$Valor=""
$mensaje="Reiniciando la estacion de trabajo"
$mcambio="Se inicia proceso de cambios en el equipo"
$mLinea="------------------------------------------"
$mTexto="Script de Actualizacion del sistema DHCP"
$mBackup="Backup del registro generado correctamente"
$mErr=" ERROR DE BACKUP - Contacte con el Administrador "
$mNCambio="No se realizan Cambios"
$mCambioR="Modificando Clave del registro"
$mInicio="Iniciando Backup del registro"
$Notifica="El ERROR a estado notificado al Administrador"
$Finaliza="Cambios realizados correctamente"

;---------------------------------
;Start SCRIPT (MAIN)
;---------------------------------

$RCode= ExistKey($REG1)
If $RCode <> 0
? "Ya dispone de DHCP en este equipo"
goto ("END1")
else
? $mcambio
gosub ("COPIASEG")
gosub ("INICIO")

? $Finaliza
;gosub ("RESTART")

endif
goto ("END1")

:END1
; Finalización de todos los procedimientos.
quit
RETURN


;------------------------------------------------------------------
; SUBRUTINA Inicio de lectura de los datos - Registro
; El proceso de Backup corresponde a varios bloques
; COPIASEG
;------------------------------------------------------------------
:COPIASEG

? $mInicio
MD $Backup
$Registro = SAVEKEY ($REG1,$Backup+"Registro.bk")
If $Registro = 0
? $mLinea
? $mBackup
? $mLinea
Else
? $mLinea
? $mErr
? $mLinea
goto ("END1")
Endif
$Registro = SAVEKEY ($REG2,$Backup+"Registro2.bk")
If $Registro = 0
? $mLinea
? "Backup2->"+$mBackup
? $mLinea
Else
? $mLinea
? $mErr
? $mLinea
goto ("END1")
Endif

RETURN

;---------------------------------------------------------------------
; SUBRUTINA Inicio de lectura de los datos - Registro
; BLOQUE 1
; INICIO - RUN Function - Scan Registry
;---------------------------------------------------------------------
:INICIO
$Contador=0
:Loop
$KeyName=ENUMKEY($REG1,$Contador)
IF @ERROR=259
? "Final de Subclaves"
Endif
IF @ERROR=0
;? "Subcadena : " + $KeyName
$Valor=RTRIM(SUBSTR($KeyName,1,1))
IF $Valor="{"
? $mLinea
? "Valor de NetworkString Localizado"
? "Subcadena : " + $KeyName
? $mLinea

$ValGen= $REG1+$KeyName+"\"+$SubCadena
gosub ("SUBVALOR") ; Verificacion para cambios
Endif
$Contador = $Contador + 1
goto ("Loop")
Endif
RETURN

;---------------------------------------------------------
; LOCALIZACION DE DATOS DE SUBVALOR
; BLOQUE 1
; SUBVALOR
; Scan Subval, and change values (DHCP)
;---------------------------------------------------------
:SUBVALOR
$Contador2=0
$Valor2=0
? $mLinea
? "Verificando Datos DHCP"
? $mLinea
:Loop2
$KeyName2=ENUMVALUE($VALGen,$Contador2)
$Valor2=READVALUE($ValGen,$KeyName2)

IF @ERROR=0
? $KeyName2 + ":" + $Valor2
;------------------------------------------------------
; Verificacion de la clave Inicial EnableDHCP
;------------------------------------------------------
If $KeyName2 = "EnableDHCP"
If $Valor2 <> "1"
? "El Valor dispone de IP Fija no es DHCP****"
? $mNCambio
; añadir cambio del registro en la siguiente clave EnableDHCP = 1

$REG01="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\"+$KeyName+"\Parameters\tcpip"
$REG02="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\"+$KeyName
$REG03="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"

WriteValue($REG01,"EnableDHCP","1", "REG_DWORD")
WriteValue($REG01,"SubnetMask","0.0.0.0","REG_MULTI_SZ")
WriteValue($REG01,"DefaultGateway","","REG_MULTI_SZ")
WriteValue($REG01,"IPAddress","0.0.0.0","REG_MULTI_SZ")
WriteValue($REG1,"Start","2","REG_DWORD")

;------------------------------------------------------------------------------------
; activa el uso de WINS para Windows y la resolución DNS
;------------------------------------------------------------------------------------
WriteValue($REG02,"EnableDHCP","1", "REG_DWORD")
WriteValue($REG02,"SubnetMask","0.0.0.0","REG_MULTI_SZ")
WriteValue($REG02,"IPAutoconfigurationAddress","0.0.0.0","REG_SZ")
WriteValue($REG02,"DefaultGateway","","REG_MULTI_SZ")
WriteValue($REG02,"DefaultGatewayMetric","","REG_MULTI_SZ")
WriteValue($REG02,"IPAddress","0.0.0.0","REG_MULTI_SZ")

;** Abria que tocar estas variables del registro pero de momento no son necesarias.
;WriteValue($REG1+"NetBT\Parameters\Interfaces\tcpip_"+$KeyName,"NameServer","","REG_SZ")
;WriteValue($REG1+"NetBT\Parameters\Interfaces\tcpip_"+$KeyName,"NameServerBackup","","REG_SZ")

WriteValue($REG03,"SearchList","","REG_SZ")
WriteValue($REG03,"Domain","","REG_SZ")
WriteValue($REG03,"NameServer","","REG_SZ")

? "KEYNAME***" +$KeyName+"***"
else
? "El valor DHCP esta activado****"
? $mLinea
? "NO se realizan Cambios"
;? "KEYNAME***" +$KeyName+"***"
Endif
Endif
;---------------------------------------------------
; Verificacion de la clave Inicial IPAddress
;---------------------------------------------------
If $KeyName2 = "IPAddress"
If $Valor2 = "0.0.0.0" OR $Valor2 = "0.0.0.0|"
?$mLinea
? "El valor de IPAddress ES DHCP"
?$mLinea
else
? "El Valor dispone de IP Fija no es DHCP"
; añadir cambio del registro

;? "El valor Parece que ES DHCP"

Endif
Endif
;------------------------------------------------------
; Verificacion de la clave Inicial SubnetMask
;------------------------------------------------------
If $KeyName2 = "SubnetMask"
If $Valor2 = "0.0.0.0" OR $Valor2 = "0.0.0.0|"
?$mLinea
? "El valor de SubNetMask es DHCP"
?$mLinea
else
? "El Valor dispone de SubNetMask no es DHCP"
; añadir cambio del registro
? "El valor Parece que ES DHCP"
Endif
Endif
$Contador2 = $Contador2 + 1
goto ("Loop2")
Endif

RETURN


;--------------------------------------------
; Reinicio de la estacion de trabajo
;--------------------------------------------
:RESTART
; Eliminar comentario de la orden SHELL una vez verificado el correcto funcionamiento del
; respectivo SCRIPT de DHCP.

SHELL "%COMPSPEC% /C Reinicia.bat"

RETURN


_________________________
Regads... Javier Sanchez

Top
Page 1 of 1 1


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

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.061 seconds in which 0.029 seconds were spent on a total of 12 queries. Zlib compression enabled.

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