Windows Management Instrumentation - Wireless Networking Example

Wireless Networking Example

In the .NET framework, the ManagementClass class represents a Common Information Model (CIM) management class. A WMI class can be a Win32_LogicalDisk in the case of a disk drive, or a Win32_Process, such as a running program like Notepad.exe.

This example shows how "MSNdis_80211_ServiceSetIdentifier" WMI class is used to find the SSID of the Wi-Fi network that the system is currently connected to in the language C#:

ManagementClass mc = new ManagementClass("root\\WMI", "MSNdis_80211_ServiceSetIdentifier", null); ManagementObjectCollection moc = mc. GetInstances; foreach (ManagementObject mo in moc) { string wlanCard = (string)mo; bool active; if (!bool.TryParse((string)mo, out active)) { active = false; } byte ssid = (byte)mo; }

The "MSNdis_80211_ServiceSetIdentifier" WMI class is only supported on Windows XP and Windows Server 2003.

Read more about this topic:  Windows Management Instrumentation