Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

configure NIC speed and duplex 1

Status
Not open for further replies.

brian32

Vendor
Mar 20, 2005
35
US
Hi. How can I write a vbscript that changes the link speed and duplex to 100 mb Full, for Intel or Broadcom NICs? This is for Dell computers running XP pro. Thanks.
 
have a look at the WMI classes for NIC and NIC configurations, if not i am sure Intel and Broadcom supply command line utils to do that sort of thing
 
We had a similar problem recently but, using 'Scriptomatic 2', found that WMI didn't appear to expose what we were (and you are) looking for.

We ended up using AutoHotkey (see to create a script (and then compile into an executable) that forced both Intel and Broadcom NIC's to change from '10Mb half-duplex' to 'Auto'. Saved a LOT of floor-walking!

Hope this helps...
 
Hey Rick, is there any way I could get a copy of your script that you wrote for this???
 
Just an FYI. Until Vista all the settings in WMI are read only. I needed to set all NICS on our olders servers to 100 FULL and tried to get or write a script to do it. Ended up doing it by hand. In Vista those settings are supposed to be read/write I have heard.



Thanks

John Fuhrman
Titan Global Services
 
Here's the script. Copy/paste it into Notepad then save it as something like 'set-nic-speed-to-auto.ahk'. It doesn't matter what it's called but it must end in '.ahk'.

Code:
; AutoHotkey script to force LAN link speed and duplex mode to AUTO
; Recognises Intel PRO/100 and Broadcom NetXtreme + NetLink chipsets only
; Assumes Folder Options/Tasks='Windows classic folders' setting
; If the card setting was different than Auto then PC will experience
; short loss of network access during net card reset
 
; Let PC load settle before running the script (3 min)
Sleep 180000
 
; Open Network Connections
Run ncpa.cpl
WinWaitActive, Network Connections,
 
; Pick the first (alphabetically) object starting with L and open its Status window
Send, L{ENTER},
WinWaitActive, Local Area,
 
; Press Properties button to open its window
Send, {SPACE},
sleep, 200
WinWait, Local Area,
IfWinNotActive, Local Area, , WinActivate, Local Area,
WinWaitActive, Local Area,
 
; Press Configure button to open h/w Properties window
sleep 1000
Send, {ENTER},
Sleep 5000
 
; Select Advanced tab and then select Property list
Send, {TAB 4},
Send, {RIGHT}{TAB}
 
;Which card?
;For Speed&Duplex select Auto value and close Properties window
IfWinExist, Broadcom NetXtreme
{
Send, s{TAB}a{TAB}{ENTER}
}
Else IfWinExist, Broadcom NetLink
{
Send, s{TAB}a{TAB}{ENTER}
}
Else IfWinExist, Intel(R) PRO/100
{
Send, l{TAB}a{TAB}{ENTER}
}
Else
{
MsgBox Your PC uses neither Intel nor Broadcom chipset`n`nUse Control Panel/Network Connections/Properties/Configure/Advanced`n to set Link Speed to Auto
WinClose, A
}
 
;Close Status and Network Connections Windows
WinClose Local Area
WinClose Network Connections

Open the script with AutoHotkey. When you're happy it works as you want in your own environment then use AutoHotkey to compile it.

Hope this helps...
 
Hi Rick,

Thank you for your wonderful script and tips. I tested it, in most case it works fine. However the script failed in two situations bellow. I got the message box at the end and there was no changes made

1. Run on Windows Vista (both locally and through login script)
2. Run on Windows XP via login script through Group Policy. The script did run and open Local Area Properties, but didn't recognize the NIC and whent straight to the message box at the end of the script, even though the NIC card is Broadcom. I know it works because I can run locally fine.

Could you give me some insight why it happened that way?

My hat is off to you:)
 
sktala,

Sorry but...

1) I never tested against Vista (and we have no [corporate] plans to deploy Vista until 2009 at the earliest).

2) We pushed this out as a silent exe using Novell (not Microsoft) as the primary login environment against a (very tightly-)controlled hardware range.

As a result it's difficult (if not impossible) to help any further about your own environment.


 
oriba68@gmail.com

I have a very simple solution which implies to know its environment well. Th
is example modifies in Auto (strValue = 0) for Intel Nic(SpeedDuplex) and Broadcom NIC (RequestedMediaType).

Can be used with computer GPO.

Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."

Set oReg=GetObject(" winmgmts:{impersonationLevel=impersonate
}!\\" & _
strComputer & "\root\default:StdRegProv")

strKeyPath = " System\Currentcontrolset\Control\Class\{
4D36E972-E325-11CE-BFC
1-08002be10318}"

oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

For Each subkey In arrSubKeys

' Cartes Intel - SpeedDuplex
oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey, "Spee
dDuplex", strValue
If strValue <> 0 Then
strValue = 0
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & subkey, "Spee
dDuplex", strValue

End If

' Cartes Broadcom - RequestedMediaType
oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey, "Reque
stedMediaType", strValue
If strValue <> 0 Then
strValue = 0
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath & "\" & subkey, "Requ
estedMediaType", strValue

End If

Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top