NetworkInformation.GetLanIdentifiers Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Important
Location consent is now required for Wi-Fi BSSID access. For details on how this affects apps using Wi-Fi or location APIs, see Changes to API behavior for Wi-Fi access and location.
Gets an array of LanIdentifier objects that contain locality information for each NetworkAdapter object that currently connected to a network.
public:
static IVectorView<LanIdentifier ^> ^ GetLanIdentifiers();
static IVectorView<LanIdentifier> GetLanIdentifiers();
public static IReadOnlyList<LanIdentifier> GetLanIdentifiers();
function getLanIdentifiers()
Public Shared Function GetLanIdentifiers () As IReadOnlyList(Of LanIdentifier)
Returns
An array of LanIdentifier objects.
Examples
Retrieve LAN identifiers (C#):
using Windows.Networking.Connectivity;
var identifiers = NetworkInformation.GetLanIdentifiers();
foreach (var id in identifiers)
{
// App-specific: map id.InfrastructureId and id.PortId to network diagnostics logs.
}
Remarks
Use this method when you need link layer metadata, such as wired chassis and port identifiers or Wi-Fi BSSID values, to
correlate connectivity with diagnostics or enterprise provisioning tasks. Access the returned LanIdentifier instances
to inspect LanIdentifier.InfrastructureId, LanIdentifier.PortId, and
LanIdentifier.NetworkAdapterId.