The below code works fine in Win XP til determine the WLAN Card, but in Windows 7 the wmiObjects count is zero.
Does anyone have any knowledge to get it working in Windows 7?
//Use MSDis802_11_Configuration to determine if this nic is in the list of wlan cards
try
{
ObjectQuery query = new ObjectQuery("SELECT * FROM MSNdis_80211_Configuration");
ManagementObjectCollection wmiObjects = new ManagementObjectSearcher(new ManagementScope(@"\\.\root\wmi"), query).Get();
//Go through the result, if an instance matches this card, determine that it is wireless
foreach (ManagementObject obj in wmiObjects)
{
string instanceName = obj.GetPropertyValue("InstanceName") as String;
if (String.Compare(instanceName, _name) == 0)
{
isWireless = true;
break;
}
}
Log.DoLog("Items found: " + wmiObjects.Count);
}
you can use managed api on codeplex http://managedwifi.codeplex.com/