Set WLAN BSSID

  • Thread starter =?iso-8859-1?Q?Thorbj=F8rn_J=F8rgensen?=
  • Start date
?

=?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
 
W

Willy Denoyette [MVP]

You need to commit the change by a call to ManagementObject.Put() or one of the overloads.

Willy.

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
 
?

=?iso-8859-1?Q?Thorbj=F8rn_J=F8rgensen?=

Hi Willy
Thank you very much for your reply. I have just tried the ManagementObject.Put() command after I have set the new BSSID, and that results in an error.
ManagementException was Unhandled:
Not Supported
I have translated the error message from danish, so it might not be the exact same error message that is provided in a more internation language.
Any suggestions?
According to the WMI Object Browser the property should be writable...

Regards
Thorbjørn

"Willy Denoyette [MVP]" <[email protected]> skrev i en meddelelse You need to commit the change by a call to ManagementObject.Put() or one of the overloads.

Willy.

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
 
W

Willy Denoyette [MVP]

Yes, but being writable does not mean that you can modify the attribute of the WAN device.
In you case, you want to change the MAC address of the WAN port of a Wireless router device, right. The writable property ""Ndis80211MacAddress" is stored in the WMI repository, you can modify this property, but once you commit the change by calling Put, WMI will ask the associated device provider to apply the modification to the property in the device, which fails with "Not Supported" because the provider does not implement this feature. One possible reason is that the provider has no means to communicate changes back to the device, that is, the provider is read-only, did you try to modify the BSSID instead of the MAC address? Note that you can use Wbemtest for this, you don't have to write any code.

Willy.

Hi Willy
Thank you very much for your reply. I have just tried the ManagementObject.Put() command after I have set the new BSSID, and that results in an error.
ManagementException was Unhandled:
Not Supported
I have translated the error message from danish, so it might not be the exact same error message that is provided in a more internation language.
Any suggestions?
According to the WMI Object Browser the property should be writable...

Regards
Thorbjørn

"Willy Denoyette [MVP]" <[email protected]> skrev i en meddelelse You need to commit the change by a call to ManagementObject.Put() or one of the overloads.

Willy.

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
 
?

=?iso-8859-1?Q?Thorbj=F8rn_J=F8rgensen?=

Hi again
The BSSID might have been a bad example, but as I understand the property Ndis80211MacAddress in the MSNdis_80211_BaseServiceSetIdentifier object, should indicate the BSSID the WLAN NIC is associated with, but I think I can see why change of it is not supported...
To make something work, I have instead tried to change the SSID to make the WLAN card associate with another access point. But I still get the NotSupported error. I have also tried to change it through the Wbemtest tool, but with the same result. I think that a change of SSID should be implemented...
I begin to suspect that it is not possible to change these thigs through WMI, but I quite do not have any idea on how else to change them.
According to http://msdn.microsoft.com/library/d..._bca9862e-feea-406f-b11d-ea01859bfbd3.xml.asp NDIS drivers should support changes in the BSSID and SSID, so I thought that they also should be updateable through WMI...

Regards...
Thorbjørn

"Willy Denoyette [MVP]" <[email protected]> skrev i en meddelelse Yes, but being writable does not mean that you can modify the attribute of the WAN device.
In you case, you want to change the MAC address of the WAN port of a Wireless router device, right. The writable property ""Ndis80211MacAddress" is stored in the WMI repository, you can modify this property, but once you commit the change by calling Put, WMI will ask the associated device provider to apply the modification to the property in the device, which fails with "Not Supported" because the provider does not implement this feature. One possible reason is that the provider has no means to communicate changes back to the device, that is, the provider is read-only, did you try to modify the BSSID instead of the MAC address? Note that you can use Wbemtest for this, you don't have to write any code.

Willy.

Hi Willy
Thank you very much for your reply. I have just tried the ManagementObject.Put() command after I have set the new BSSID, and that results in an error.
ManagementException was Unhandled:
Not Supported
I have translated the error message from danish, so it might not be the exact same error message that is provided in a more internation language.
Any suggestions?
According to the WMI Object Browser the property should be writable...

Regards
Thorbjørn

"Willy Denoyette [MVP]" <[email protected]> skrev i en meddelelse You need to commit the change by a call to ManagementObject.Put() or one of the overloads.

Willy.

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
 
W

Willy Denoyette [MVP]

NDIS 5.1 defines the OID's which are read-only and which are writable, but this doesn't say it should be done thru WMI.
Please take care about this sentense:
The WLAN OIDs are available through Windows Management Instrumentation (WMI).
Network set-up utilities in general talk directly to the NDIS driver using the DeviceIOControl API, they don't use WMI for this, you should contact the vendor to be sure about this though.
The card can be configured using a vendor supplied utility, or the normal Windows Network set-up applet , or am I wrong?
Willy.

Hi again
The BSSID might have been a bad example, but as I understand the property Ndis80211MacAddress in the MSNdis_80211_BaseServiceSetIdentifier object, should indicate the BSSID the WLAN NIC is associated with, but I think I can see why change of it is not supported...
To make something work, I have instead tried to change the SSID to make the WLAN card associate with another access point. But I still get the NotSupported error. I have also tried to change it through the Wbemtest tool, but with the same result. I think that a change of SSID should be implemented...
I begin to suspect that it is not possible to change these thigs through WMI, but I quite do not have any idea on how else to change them.
According to http://msdn.microsoft.com/library/d..._bca9862e-feea-406f-b11d-ea01859bfbd3.xml.asp NDIS drivers should support changes in the BSSID and SSID, so I thought that they also should be updateable through WMI...

Regards...
Thorbjørn

"Willy Denoyette [MVP]" <[email protected]> skrev i en meddelelse Yes, but being writable does not mean that you can modify the attribute of the WAN device.
In you case, you want to change the MAC address of the WAN port of a Wireless router device, right. The writable property ""Ndis80211MacAddress" is stored in the WMI repository, you can modify this property, but once you commit the change by calling Put, WMI will ask the associated device provider to apply the modification to the property in the device, which fails with "Not Supported" because the provider does not implement this feature. One possible reason is that the provider has no means to communicate changes back to the device, that is, the provider is read-only, did you try to modify the BSSID instead of the MAC address? Note that you can use Wbemtest for this, you don't have to write any code.

Willy.

Hi Willy
Thank you very much for your reply. I have just tried the ManagementObject.Put() command after I have set the new BSSID, and that results in an error.
ManagementException was Unhandled:
Not Supported
I have translated the error message from danish, so it might not be the exact same error message that is provided in a more internation language.
Any suggestions?
According to the WMI Object Browser the property should be writable...

Regards
Thorbjørn

"Willy Denoyette [MVP]" <[email protected]> skrev i en meddelelse You need to commit the change by a call to ManagementObject.Put() or one of the overloads.

Willy.

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
 
?

=?iso-8859-1?Q?Thorbj=F8rn_J=F8rgensen?=

Hi
Excessive tries have unfortunately not resulted in a written a value, hence I do not think it is possible to changes the values through WMI at all. I am now trying to communicating directly with the NDIS driver using the OIDs, which I hope will be more successsfull. I had hoped that it was possible through WMI since it is very straight forward...
I still quite not understand why there is not a API that would provide the access to the properties, but it might come in future version :)

I really appriciated your replyies today... Thank you...

Regards...
Thorbjørn

"Willy Denoyette [MVP]" <[email protected]> skrev i en meddelelse NDIS 5.1 defines the OID's which are read-only and which are writable, but this doesn't say it should be done thru WMI.
Please take care about this sentense:
The WLAN OIDs are available through Windows Management Instrumentation (WMI).
Network set-up utilities in general talk directly to the NDIS driver using the DeviceIOControl API, they don't use WMI for this, you should contact the vendor to be sure about this though.
The card can be configured using a vendor supplied utility, or the normal Windows Network set-up applet , or am I wrong?
Willy.

Hi again
The BSSID might have been a bad example, but as I understand the property Ndis80211MacAddress in the MSNdis_80211_BaseServiceSetIdentifier object, should indicate the BSSID the WLAN NIC is associated with, but I think I can see why change of it is not supported...
To make something work, I have instead tried to change the SSID to make the WLAN card associate with another access point. But I still get the NotSupported error. I have also tried to change it through the Wbemtest tool, but with the same result. I think that a change of SSID should be implemented...
I begin to suspect that it is not possible to change these thigs through WMI, but I quite do not have any idea on how else to change them.
According to http://msdn.microsoft.com/library/d..._bca9862e-feea-406f-b11d-ea01859bfbd3.xml.asp NDIS drivers should support changes in the BSSID and SSID, so I thought that they also should be updateable through WMI...

Regards...
Thorbjørn

"Willy Denoyette [MVP]" <[email protected]> skrev i en meddelelse Yes, but being writable does not mean that you can modify the attribute of the WAN device.
In you case, you want to change the MAC address of the WAN port of a Wireless router device, right. The writable property ""Ndis80211MacAddress" is stored in the WMI repository, you can modify this property, but once you commit the change by calling Put, WMI will ask the associated device provider to apply the modification to the property in the device, which fails with "Not Supported" because the provider does not implement this feature. One possible reason is that the provider has no means to communicate changes back to the device, that is, the provider is read-only, did you try to modify the BSSID instead of the MAC address? Note that you can use Wbemtest for this, you don't have to write any code.

Willy.

Hi Willy
Thank you very much for your reply. I have just tried the ManagementObject.Put() command after I have set the new BSSID, and that results in an error.
ManagementException was Unhandled:
Not Supported
I have translated the error message from danish, so it might not be the exact same error message that is provided in a more internation language.
Any suggestions?
According to the WMI Object Browser the property should be writable...

Regards
Thorbjørn

"Willy Denoyette [MVP]" <[email protected]> skrev i en meddelelse You need to commit the change by a call to ManagementObject.Put() or one of the overloads.

Willy.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top