4

My school uses 802.11a, but at home I use 802.11b. This means every time I go from home to school or the other way I have to go to device manager -> Network adapters -> Intel(R) WiFi Link 5100 AGN -> properties -> advanced -> wireless mode -> change the value.

I would like to make a small c# program that does this for me, but I don't know where to start.

Can someone point me in the right direction, I have no idea on where to get started.

I have received an answer from MSDN - but I have not tested it yet. http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/3a8a096d-b0e8-488c-930f-12735e5f7b4b

SOLUTION After working with this a bit, I found a solution. First i used Process monitor to figure out which registry values were changed, when I changed the wireless mode manually.

Now changing the value contains 2 steps. The name for the wireless modes are mapped to a number. The numbers are then mapped in a different registry key to a wireless mode number. So first I found the number based on the name, and then I set the value in a different registry key.

After that the Network adapter has to be reset, which I used WMI to do.

I got help in This thread on MSDN.

I am not sure, if it works across all windows OS, and I am not sure if it works across all network adapters. Anyways, this is what I did.

Casper Thule Hansen
  • 1,510
  • 2
  • 19
  • 36

3 Answers3

1

SOLUTION After working with this a bit, I found a solution. First i used Process monitor to figure out which registry values were changed, when I changed the wireless mode manually.

Now changing the value contains 2 steps. The name for the wireless modes are mapped to a number. The numbers are then mapped in a different registry key to a wireless mode number. So first I found the number based on the name, and then I set the value in a different registry key.

After that the Network adapter has to be reset, which I used WMI to do.

I got help in This thread on MSDN.

I am not sure, if it works across all windows OS, and I am not sure if it works across all network adapters. Anyways, this is what I did.

Casper Thule Hansen
  • 1,510
  • 2
  • 19
  • 36
1

you want to dig into System.Management namespace to mess with devices http://msdn.microsoft.com/en-us/library/system.management.aspx

Alex
  • 23,004
  • 4
  • 39
  • 73
  • I've looked into it, but I can't find the property I am looking for. I've tried the following: Select * from Win32_NetworkAdapterConfiguration Select * from Win32_NetworkAdapter Select * from Win32_NetworkClient Select * from Win32_NetworkConnection Select * from Win32_NetworkLoginProfile Select * from Win32_NetworkProtocol – Casper Thule Hansen Nov 30 '11 at 11:40
  • On second thought, it might aswell be possible you have to "talk" to your adapter's driver instead of asking Windows to accomplish this task ... As a matter of fact, Windows doesn't know how devices work, drivers do (that's why Windows needs them ^^). Unfortunately I can't know for sure b/c I never tried this kind of things :( – Alex Dec 02 '11 at 08:48
  • I have not yet solved the problem, but you gave me a hint on where to look, which is the answer for the question. Thanks – Casper Thule Hansen Dec 05 '11 at 07:55
0

There is a API written to access all wifi network adapters. You can find its source code at here. Hope that should get you started.

Rajesh
  • 7,766
  • 5
  • 22
  • 35