?
=?iso-8859-1?Q?Thorbj=F8rn_J=F8rgensen?=
Hi
I am trying to create an application that can configure some of the properties of a WLAN card, for instance BSSID. I can read the BSSID without any problems using the System.Management class. I have tried the following code:
public void SetWlanBaseServiceSetIdentifier(string InstanceName, byte[] BssidMac)
{
ManagementClass mc = new ManagementClass(@"root\WMI","MSNdis_80211_BaseServiceSetIdentifier",new ObjectGetOptions());
ManagementObjectCollection moc = mc.GetInstances();
foreach(ManagementObject mo in moc)
{
if((string)mo["InstanceName"]==InstanceName)
{
//TODO: Does not work correctly
mo.SetPropertyValue("Ndis80211MacAddress", BssidMac);
byte[] temp = (byte[])mo["Ndis80211MacAddress"];
}
}
}
When I have set the Bssid and read it out into the temp variable, it indicates that the value is changed. But when I use another System.Management object to read the BSSID it is not changed.
Does I need to commit the changes in some way, or what am I doing wrong?
If there is a better/another way to get control over the basic WLAN properties (I do not want to make it driver specific) I am most interrested in knowing about them?
Hope that someone can help, since goolge for once did not come up with a useful hit...
Thorbjørn
I am trying to create an application that can configure some of the properties of a WLAN card, for instance BSSID. I can read the BSSID without any problems using the System.Management class. I have tried the following code:
public void SetWlanBaseServiceSetIdentifier(string InstanceName, byte[] BssidMac)
{
ManagementClass mc = new ManagementClass(@"root\WMI","MSNdis_80211_BaseServiceSetIdentifier",new ObjectGetOptions());
ManagementObjectCollection moc = mc.GetInstances();
foreach(ManagementObject mo in moc)
{
if((string)mo["InstanceName"]==InstanceName)
{
//TODO: Does not work correctly
mo.SetPropertyValue("Ndis80211MacAddress", BssidMac);
byte[] temp = (byte[])mo["Ndis80211MacAddress"];
}
}
}
When I have set the Bssid and read it out into the temp variable, it indicates that the value is changed. But when I use another System.Management object to read the BSSID it is not changed.
Does I need to commit the changes in some way, or what am I doing wrong?
If there is a better/another way to get control over the basic WLAN properties (I do not want to make it driver specific) I am most interrested in knowing about them?
Hope that someone can help, since goolge for once did not come up with a useful hit...
Thorbjørn