Programmatically determine if WiFi direct is supported

Jason 1 Reputation point

I would like to programmatically determine if WiFi direct is supported on a given windows 10 machine... including a foreign windows 10 OS.
Most of the articles I have come across involve "IpConfig /all" and then searching for the string "Microsoft Wi-Fi Virtual Adapter".

I was able to run "IpConfig" from c# and search the output just fine. However, this solution will not work on a non-English OS as I suspect "Virtual Adapter" will be translated.

Another common online solution is to run "netsh wlan show wirelesscap". This command dumps a lot of capabilities, including several WiFi Direct support ones. However, if this gets translated by a non-English OS it is not a solution.

I have also tried using the NetworkInterface class. The following line will return both virtual and physical wifi adapters:
NetworkInterface.GetAllNetworkInterfaces().Where(nic => nic.NetworkInterfaceType == NetworkInterfaceType.Wireless80211)
Unfortunately, except for the Name properties, physical adapters and virtual ones seem to look identical. I have not found a way to distinguish them.

The last approach I tried was to use UWP WinRT. The following code returns a list of WiFi Adapters, but only physical ones:
IReadOnlyList<WiFiAdapter> adapters = await WiFiAdapter.FindAllAdaptersAsync();

So, the bottom line question: How do I programmatically check for WiFi Direct support? The solution needs to work on both an English OS and a non-English OS.


Universal Windows Platform (UWP)
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,205 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Roy Li - MSFT 31,551 Reputation points Microsoft Vendor


    Welcome to Microsoft Q&A!

    Currently, there is no direct way to detect if this is supported. Generally, we will create a WiFiDirectAdvertisementPublisher Class and call the WiFiDirectAdvertisementPublisher.Start Method first before we searching for wifi direct devices. If the WiFiDirectAdvertisementPublisher.Status Property is not Started, the device may not support the wifi direct function.

    Another way is to use the Device Portal Rest API to request the networking information. Here is the document: Networking. But you need to enable the Device Portal
    in your device before you start to call the rest API.

    The way that running the ipconfig command in CMD is the easiest way to check the WiFi Direct capability.

    Thank you.

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Castorix31 81,461 Reputation points

    You could test if WFDOpenHandle succeeds

    0 comments No comments