3

enter image description here

Just like the screenshot, I want to use C# to set the Link Speed and Duplex mode for Network adapters. For example, change the settings from Auto Negotiation to 10 Mbps Half Duplex.

Could you please point me out that how to start?

Thanks

SuT

SUT
  • 384
  • 1
  • 7
  • 23

2 Answers2

1

The windows network configuration dll's are poorly (in best cases) documented. The easiest way for configuring values in the network is using netsh

Best way to programmatically configure network adapters in .NET

The netsh calls the weird undocummented windows dll's. If you need call directly a dll instead of executing a command, you can start debugging the netsh.

Community
  • 1
  • 1
  • 2
    This answer and the one in the link do not answer the question `"How to set the duplex speed of a nic"`. The link shows how to set dhcp or a static ip using netsh. There doesn't appear to be a netsh command to set duplex/link speed. – Despertar Mar 23 '13 at 20:20
0

You can use C# to change the registry value of DuplexSpeed in the registry key

HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0001

that I found from here, https://superuser.com/questions/258746/change-nic-speed-duplex-settings-in-script .The number at the end will differ, but you can look at the DriverDesc value of the keys to see the name of the network device.

See http://tech.pro/tutorial/652/csharp-snippet-tutorial-editing-the-windows-registry for editing registry values with C#.

Community
  • 1
  • 1
Despertar
  • 21,627
  • 11
  • 81
  • 79