473,385 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Set WLAN BSSID

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_BaseServ iceSetIdentifier",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
Apr 11 '06 #1
6 6798
You need to commit the change by a call to ManagementObject.Put() or one of the overloads.

Willy.

"Thorbjørn Jørgensen softdoc.dk>" <thorbjorn@<REMOVE> wrote in message news:44***********************@news.sunsite.dk...
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_BaseServ iceSetIdentifier",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
Apr 11 '06 #2
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]" <wi*************@telenet.be> skrev i en meddelelse news:uK**************@TK2MSFTNGP02.phx.gbl...
You need to commit the change by a call to ManagementObject.Put() or one of the overloads.

Willy.

"Thorbjørn Jørgensen softdoc.dk>" <thorbjorn@<REMOVE> wrote in message news:44***********************@news.sunsite.dk...
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_BaseServ iceSetIdentifier",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
Apr 11 '06 #3
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.

"Thorbjørn Jørgensen softdoc.dk>" <thorbjorn@<REMOVE> wrote in message news:44***********************@news.sunsite.dk...
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]" <wi*************@telenet.be> skrev i en meddelelse news:uK**************@TK2MSFTNGP02.phx.gbl...
You need to commit the change by a call to ManagementObject.Put() or one of the overloads.

Willy.

"Thorbjørn Jørgensen softdoc.dk>" <thorbjorn@<REMOVE> wrote in message news:44***********************@news.sunsite.dk...
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_BaseServ iceSetIdentifier",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
Apr 11 '06 #4
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/de...9bfbd3.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]" <wi*************@telenet.be> skrev i en meddelelse news:O9**************@TK2MSFTNGP05.phx.gbl...
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.

"Thorbjørn Jørgensen softdoc.dk>" <thorbjorn@<REMOVE> wrote in message news:44***********************@news.sunsite.dk...
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]" <wi*************@telenet.be> skrev i en meddelelse news:uK**************@TK2MSFTNGP02.phx.gbl...
You need to commit the change by a call to ManagementObject.Put() or one of the overloads.

Willy.

"Thorbjørn Jørgensen softdoc.dk>" <thorbjorn@<REMOVE> wrote in message news:44***********************@news.sunsite.dk...
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_BaseServ iceSetIdentifier",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
Apr 11 '06 #5
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.

"Thorbjørn Jørgensen softdoc.dk>" <thorbjorn@<REMOVE> wrote in message news:44***********************@news.sunsite.dk...
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/de...9bfbd3.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]" <wi*************@telenet.be> skrev i en meddelelse news:O9**************@TK2MSFTNGP05.phx.gbl...
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.

"Thorbjørn Jørgensen softdoc.dk>" <thorbjorn@<REMOVE> wrote in message news:44***********************@news.sunsite.dk...
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]" <wi*************@telenet.be> skrev i en meddelelse news:uK**************@TK2MSFTNGP02.phx.gbl...
You need to commit the change by a call to ManagementObject.Put() or one of the overloads.

Willy.

"Thorbjørn Jørgensen softdoc.dk>" <thorbjorn@<REMOVE> wrote in message news:44***********************@news.sunsite.dk...
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_BaseServ iceSetIdentifier",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
Apr 11 '06 #6
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]" <wi*************@telenet.be> skrev i en meddelelse news:eQ**************@TK2MSFTNGP05.phx.gbl...
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.

"Thorbjørn Jørgensen softdoc.dk>" <thorbjorn@<REMOVE> wrote in message news:44***********************@news.sunsite.dk...
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/de...9bfbd3.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]" <wi*************@telenet.be> skrev i en meddelelse news:O9**************@TK2MSFTNGP05.phx.gbl...
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.

"Thorbjørn Jørgensen softdoc.dk>" <thorbjorn@<REMOVE> wrote in message news:44***********************@news.sunsite.dk...
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]" <wi*************@telenet.be> skrev i en meddelelse news:uK**************@TK2MSFTNGP02.phx.gbl...
You need to commit the change by a call to ManagementObject.Put() or one of the overloads.

Willy.

"Thorbjørn Jørgensen softdoc.dk>" <thorbjorn@<REMOVE> wrote in message news:44***********************@news.sunsite.dk...
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_BaseServ iceSetIdentifier",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
Apr 12 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Steven Van Dalem | last post by:
Pocket FrameWork VS2003 - VB Is there an easy way to tell if you are in range of the WLan, and thus connected? I would like to know this before I try to send information over the network. ...
16
by: lgbjr | last post by:
Hi All, I've been given an XML file (12 MB) that I need to extract data from. The XML file makes the data easy to view, but the data is impossible to analyze in its current format. I've looked...
4
by: Vhdl.eu | last post by:
Hi all, Is there anyone who knows how to access the Wlan Driver in Windows XP by mean of a VB.NET application? In other words; how can I use the Wlan driver from Windows in my next VB.NET...
5
by: =?Utf-8?B?VGhvbWFzWg==?= | last post by:
Hi, I got a project coming that requires my app to connect together 3 or more computers by Wireless network without a WLAN router available. I believe it could be done with some kind of software...
1
by: irvine4ever84 | last post by:
I have a notepad,which having a data store into it and then overwrite by a new data every 1 second constantly. I want to read the data (which is the total bandwidth usage of my whole WLAN)which...
0
by: =?Utf-8?B?QmVybmQgWA==?= | last post by:
I have the following problem: I want to set up an ad-hoc network between several PDAs. I did set it up with Windows Sockets, but the when a new PDA arrives in the network it takes quite some time...
0
by: ELEV | last post by:
I am running a program that uses web services to save data that I am inputting into it. Now everything works fine it can connect just fine and input and output data to the web service from my...
10
by: ycinar | last post by:
I am trying to familiarize myself with a C++ application which has a bug. I'd like to have the application connect to WLAN when LAN is not available and vice versa. Basically, it fails to...
0
by: Zidan26 | last post by:
Hi Everybody! I need help. I want Import to C# struct written in C++. C++ code: typedef struct {
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.