I have an application written in C # that should extract information such as IP address, subnet mask from a disconnected network adapter.
I tried using various methods such as WMI and the .NET NetworkAdapter class, but they do not return useful data when disconnecting the network adapter. I am sure Windows stores this information somewhere, since I can apply network settings using netsh and it displays correctly on the control panel.
One thing that worked for me in XP was to analyze the output of the tool netsh, and it returned information even for a disconnected adapter. However, this does not work on Windows 7.
Win XP output:
Configuration for interface "Local Area Connection 5"
DHCP enabled: No
IP Address: 169.254.0.128
SubnetMask: 255.255.255.0
InterfaceMetric: 0
Win7 Output:
Configuration for interface "Local Area Connection 2"
DHCP enabled: No
InterfaceMetric: 5
Any ideas?