Weird, I had already posted a response to this question. 
Anyway, when I ran your code here I noticed that the first 4 bytes of the ssid bytearray were 0x0A, 0x00, 0x00 and 0x00, and only int the 5th byte the actual name of the ssid started.
I changed the code to cut those first 4 bytes, and it seemed to work alright:
[]s Badaro
Anyway, when I ran your code here I noticed that the first 4 bytes of the ssid bytearray were 0x0A, 0x00, 0x00 and 0x00, and only int the 5th byte the actual name of the ssid started.
I changed the code to cut those first 4 bytes, and it seemed to work alright:
Code:
ManagementClass mc = new ManagementClass("root\\WMI","MSNdis_80211_ServiceSetIdentifier", null);
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
string wlanCard = (string)mo["InstanceName"];
bool active = (bool)mo["Active"];
byte[] buffer = (byte[])mo["Ndis80211SsId"];
byte[] ssid = new Byte[buffer.Length-4];
for(int i=4;i<buffer.Length;i++)
{
ssid[i-4] = buffer[i];
}
string ssidString = Encoding.ASCII.GetString(ssid);
MessageBox.Show(ssidString);
}