Changing IP address


I'm writing a program to change the IP address of a PC in Windows XP and NT.
I tried to manually change the IP address of a PC (using control panel)and there are 2 places in registry being changed.
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\{Adapter... ID}\Parameters\Tcpip]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\Adapter... ID]

do i need to change these 2 places ?
I understand that the main place to change is
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\Adapter... ID]IPAddress="XXX"

but do i need to change [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\{Adapter... ID}\Parameters\Tcpip]IPAddress="XXX" ?
what is this registry for ?

Appreciate your advice , thanks in advance.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

why bother using registry for this use windows in-built commands to use in yours program

if u want to set up ip address via cmd in windows >>:—

netsh interface ip set address name=”Local Area Connection” static 1
the last 1 indicates the metric and it can be 2,3…

( Metric is the number of hops to the destination. Anything on the local LAN is one hop and each router crossed after that is an additional hop. The Metric is used to determine the best route)

if want to set up dns >>:–

1.netsh interface ip set dns “Local Area Connection” static  (THIS IS FOR primary dns server)

2.netsh interface ip add dns name=”Local Area Connection” index=2 (THIS IS FOR secondary dns server)

if want to get ip via dhcp >>:–

netsh interface ip set address name=”Local Area Connection” dhcp

if u wanna have dns via dhcp >>:–

netsh interface ip set dns name=”Local Area Connection” dhcp


chekbanAuthor Commented:
For some reason i need to change the IP in registry
B HCommented:
not sure how you'll get the adapter id, it's likely to be different between pc's

if you do it by the registry, you'll need to have a reboot after you set it, before it'll work
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

"For some reason i need to change the IP in registry "

chekbanAuthor Commented:
Basically i just want to know what is this registry for
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\{Adapter... ID}\Parameters\Tcpip]

Anyone can help ?

B HCommented:
this is all about that key:

but - you're not going to easily be able to parse the individual adapter id's from multiple machines via a script
chekbanAuthor Commented:
dear bryon,
i've seen that article before, that article only mentioned about
Tcpip\Parameters\Interfaces\ID for Adapter

and not
\CurrentControlSet\Services\{Adapter... ID}\Parameters\Tcpip]
B HCommented:
there are several places in the registry, as you've seen, where you can specify ip addresses.  services\adapter-id\parameters\tcpip tell the network card itself what to be.  some of the other values tell the stack itself what to be, others tell windows what to think it is

while looking for this for you, i came across a premade script that actually goes and finds out the adapter GUID for you, stores it in a variable, then pumps your settings back in.  a tiny bit of customization and this would do real well for you:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
"Basically i just want to know what is this registry for
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\{Adapter... ID}\Parameters\Tcpip]
IPAddress="XXX" "

This is for network interface  card you have in my case i have four adapter 1 is on board two virtual for vmware workstation and one is loopback and preference is given to on board NIC  

as you can see in pix those settings are from my 1st NIC(physical) and all comes after that


and one more thing  i forgot to type is IPAddress is used for static ip address
chekbanAuthor Commented:
not the exact answer i'm looking for. but thanks for the effort
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.