I have a laptop running Windows Server 2003 SP2, with PowerShell installed.

Occasionally, this system has to be used in environments where it needs the NIC manually set to 100 Mbps/Full Duplex in order to function correctly. In most other environments, this needs to be set to Auto-detect for best performance.

Normally, I do this through the following procedure:

  • Right-click My Network Places, select Properties.
  • Right-click Local Area Connection, select Properties
  • Click Configure
  • On the Advanced tab, select the Speed & Duplex property and change the Value from Auto to 100 Mb Full.
  • Reverse the change when done with work.

Is there a way to do this via Batch or PowerShell scripting? I'm looking to do something like this:

[Insert 100 Mbps/Full Duplex commands here]
ECHO NIC set to 100 Mbps/Full Duplex
ECHO Press any key to return to Auto-Detect
[Insert Auto-Detect commands here]
ECHO NIC returned to Auto-Detect
ECHO Press any key to exit

I've been told there may be some methods to do this via WMIC or PowerShell, but I haven't been able to find the proper switches, values, or syntax.


It seems like this is a vendor-specific setting, as noted in a technet thread Here

It notes that making a registry change to the NIC's key under HKLM\SYSTEM\CurrentControlSet\Control\Class\(GUID)\(INTNUM)\(Vendor-specific-registrykey) should be enough, but I think you should also add something in there to disable then reenable the NIC when changing it.

Here's an example Batch script that incorporates all of the above with the template in the question.

@echo off  
reg add HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0001 /v RequestedMediaType /d 6 /t REG_SZ /f  
netsh interface set interface "Local Area Connection" DISABLED  
netsh interface set interface "Local Area Connection" ENABLED  
echo Connection set to 100 Mb/Full Duplex  
echo Press any key to change back to Auto  
reg add HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0001 /v RequestedMediaType /d 0 /t REG_SZ /f  
netsh interface set interface "Local Area Connection" DISABLED  
netsh interface set interface "Local Area Connection" ENABLED  
echo Connection set to Auto  
echo Press any key to exit  

To make the above script work for you, the following may need to be changed.

  • Everything after "\Class\" in the registry key may need to be changed to match the appropriate key in your system. Look for a key starting in {4D36E972 and work from there to find the one you need.
  • The parameters for the /v, /d, and /t switches should be set to match the vendor-specific configuration for your system.
  • Change "Local Area Connection" if necessary, to match the name of the interface you are working on.

As always, be sure to make a full backup of the Registry before attempting any untested changes.    

  • Took some doing, but I finally found the keys I needed, and got everything together with the info here. – Iszi Mar 17 '11 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.