Changing IP settings in registry

L

Leif Hauge

Hi !
Can someone help me figure out if this can be done ?
I want to run a command in a special made program that can change the LAN IP
to DHCP Enable by just clicking on it. It would work fine except LAN NIC's
have a unique ID in the registry edit. How can I avoid this ?

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\{Adapter}\
Parameters\Tcpip]

{Adapter} is a long string and is unique for the LAN NIC, is it possible to
find this key somehow by scripting or other ways ?

- Leif -
Norway
 
D

Dave Patrick

You might try netsh from a command prompt;

1 to set ip address and subnet, 2 to clear previous dns server ip's, 3 to
set primary dns server, 4 to set alt dns server, 5 to set ip address DHCP
assigned

1.) netsh interface ip set address name="Local Area Connection 2"
source=static addr=192.168.10.10 mask=255.255.255.0 gateway=none
2.) netsh interface ip delete dns name="Local Area Connection 2" addr=all
3.) netsh interface ip set dns name="Local Area Connection 2" source=static
addr=192.168.20.20
4.) netsh interface ip add dns name="Local Area Connection 2"
addr=192.168.30.30
5.) netsh interface ip set address name="Local Area Connection 2"
source=dhcp

Where "Local Area Connection 2" is the name of your connection. (watch for
line wrap)


--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
| Hi !
| Can someone help me figure out if this can be done ?
| I want to run a command in a special made program that can change the LAN
IP
| to DHCP Enable by just clicking on it. It would work fine except LAN NIC's
| have a unique ID in the registry edit. How can I avoid this ?
|
| [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\{Adapter}\
| Parameters\Tcpip]
|
| {Adapter} is a long string and is unique for the LAN NIC, is it possible
to
| find this key somehow by scripting or other ways ?
|
| - Leif -
| Norway
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top