Obsolete network adapters in the registry cause connection errors

F

FraFra82

Hi,


I'm writing in the Windows 10 section, but I would need to know if the same behavior occurs in Windows 7 and 8.

I'm developing an application, with a network third part library, that use a network device plugged with an ethernet connection.

For some reasons, that I ignore, in my Network and Sharing Center the Ethernet connection sometimes get the name changed with a progressive number: the actual one it is named "Ethernet 30".

The application can't connect to the device unless I overwrite, in the code, the name of the last ethernet adapter.



Investigating, I noticed that the adapter name is obtained searching in the registry: the PnPIstanceId of the network device is searched between the locations HKEY_LOCAL_MACHINESYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\GUID_XXXXXX\Connection.



I noticed that in HKEY_LOCAL_MACHINESYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\ several GUIDs match the PnPIstanceId looked for, associated with obsolete network adapter names: i.e. "Ethernet 10", "Ethernet 20", etc.

Reading the Get-NetAdapter and Get-NetAdapterAdvancedProperty documentation I understood that the network adapter informations are stored in the location:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\xxxxxxxx



In the location i.e 0012 I found that are present the following key,values pairs:

- DeviceInstanceID: the id of the my network device (same of PnPIstanceId above)

- NetCfgInstanceId: GUID_YYYYYY



In HKEY_LOCAL_MACHINESYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\GUID_YYYYYY\Connection the key Name has value of my current active network: "Ethernet 30".



So, looking for the NetCfgInstanceId, as above, can I always find the GUID (and so the name) of the current and active network?

Since I'm not able to delete and create a new network, I can't verify if the NetCfgInstanceId value is updated with the GUID of the new network adapter, it would seem so, but can you confirm it?

I queried the WMI, powershell and the registry and I didn't find any of obsolete networks between results, I only found them in HKEY_LOCAL_MACHINESYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\, can you confirm that they are harmless?

I can't find in the documentation any behavior differences with Windows 8 or 7, could be some differences that I ignore?


Thank you very much for the support.


Best regards.


Francesco

Continue reading...
 
Back
Top Bottom