IMPORTANT CHANGE: Back to this topic. As you said, there should be no default network adapter, I'm trying to figure out if there is a way to detect all connected network adapters.
Having the MAC address of my physical interface, there is a software way to get the status of an interface / interface / etc ...
For example, my XP machine:
Realtek RTL8139 Device PCI Fast Ethernet NIC MAC Family XXXX-XXXX-XXXX
XXXX-XXXX-XXXX is what I know
Using this device, I connect using the connection "Local Area Connection" (with all the information related to both the gateway, subnet, ...)
So, I am looking for a link between XXXX-XXXX-XXXX and a local connection.
I hope everything is clear now.
Thanks everyone! Postscript Sorry for the delay ... +1 vote for everyone, for patience!
Old question
Hi everyone, I would like to change the LAN Connection IP address using the netsh command.
My problem is the programmatic way to get the default connection name (i.e., "Local Area Connection")?
thanks
EDIT: I don't need a list of all connection names, but only by default. Access to the registry I get a list, and it seems that the default is *. Unfortunately, by printing them to the console, I get 10 different "local connections", such as ...
Local Area Connection* 13 6TO4 Adapter VMware Network Adapter VMnet1 Wireless Network Connection 2 Reusable ISATAP Interface {483968F2-DBF9-4596-B8BE-725FAAB89F93} Local Area Connection* 3 Local Area Connection* 2 Reusable Microsoft 6To4 Adapter Local Area Connection* 7 VMware Network Adapter VMnet8 Local Area Connection* 8 isatap.replynet.prv Local Area Connection* 9 Local Area Connection* 12 isatap.{FAA80CE0-D641-408A-83F8-5F9C394FFD76} Bluetooth Network Connection Local Area Connection* 4 isatap.{40156BF9-6599-4912-A315-62DE5342B452} isatap.{7651F2F5-4888-4258-92C5-6822C506D726} Local Area Connection* 5 isatap.{34F5F074-8AA7-4421-AE24-131BA2DC3458} Local Area Connection* Local Area Connection* 10 Local Area Connection Local Area Connection* 6 Wireless Network Connection
etc.
EDIT2: @ ho1 by running your code, changing the FriendlyName value that does not exist with the name, you will get something like a list behind, unfortunately, it seems that this is not the expected result
0 - WAN Miniport (SSTP) 1 - WAN Miniport (IKEv2) 2 - WAN Miniport (L2TP) 3 - WAN Miniport (PPTP) 4 - WAN Miniport (PPPOE) 5 - WAN Miniport (IPv6) 6 - WAN Miniport (Network Monitor) 7 - Realtek RTL8168C(P)/8111C(P) Family PCI-E Gigabit Ethernet NIC (NDIS 6.20) 8 - WAN Miniport (IP) 9 - Microsoft ISATAP Adapter 10 - RAS Async Adapter 11 - Broadcom 802.11g Network Adapter 12 - Microsoft 6to4 Adapter 13 - VMware Virtual Ethernet Adapter for VMnet1 14 - Microsoft ISATAP Adapter