derniwi Posted April 12, 2010 Share Posted April 12, 2010 Hi,I need to detect the WiFi / WLAN interface of a computer using WMI or something else. The only way I found is currently to use the WMI filterCIMV2: SELECT Description, DeviceID, NetConnectionID FROM Win32_NetworkAdapter WHERE PhysicalAdapter=Trueand use the result of the "Description" field to check against the registry values ofHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\xxx\*MediaTypewhere xxx is a 4 digit value, i.e. "0007".As far as I found out, *MediaType = 0x0 is used by LAN interfaces, the value of 0x10 is used by WiFi adapters.Is this a good way? Could you please check this registry values, if someone have a different entry for *MediaType on the WLAN interface?The reason for this is I have to disable the WLAN interface if a network cable is plugged into the LAN interface, and enable WiFi if the cable is disconnected.Regards, Nils. Link to comment Share on other sites More sharing options...
CoffeeFiend Posted April 12, 2010 Share Posted April 12, 2010 I don't have a wifi card handy so I can't really do a whole lot. However, before resorting to crawling the registry by hand, I'd look at the AdapterTypeID property (or AdapterType; pretty much the same idea) of the Win32_NetworkAdapter WMI class first. Hopefully it would return 9 (or "Wireless") for WiFi NICs.The rest is easy enough to accomplish if this works. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now