PC Review


Reply
Thread Tools Rate Thread

Changing NIC speed and duplex option

 
 
Tom Ker
Guest
Posts: n/a
 
      7th Dec 2005
We've got a project about to start to change all our PCs from 10/Full to
Auto. Thankfully we only have 3 or 4 different NICs in our environment, but
we have 1,000s of them so I want to write a script that will do the change
for me.

Can someone point me to some code to get me started with this. please?

Thanks,

Tom


 
Reply With Quote
 
 
 
 
B-Mann
Guest
Posts: n/a
 
      8th Dec 2005

"Tom Ker" <(E-Mail Removed)> wrote in message
news:%23s0YCS1%(E-Mail Removed)...
> We've got a project about to start to change all our PCs from 10/Full to
> Auto. Thankfully we only have 3 or 4 different NICs in our environment,
> but we have 1,000s of them so I want to write a script that will do the
> change for me.
>
> Can someone point me to some code to get me started with this. please?
>
> Thanks,
>
> Tom
>


Tom,

I use the following script to set our NIC's to 100/FULL, I'm sure it can
be adapted to set yours to Auto.

The script scans the registry to obtain each NIC that is installed. For each
NIC that is found, the script will locate and apply the appropriate registry
value you define in a separate .ini file (SpdDplx.ini). The .ini file
contains the registry value for each NIC based on the vendor ID and device
ID as found in the ComponentID registry value for a given NIC. Here is my
example, keep in mind that the values listed in the .ini file are for
setting the NIC's to 100/FULL, you will need to add/edit your entries for
the NIC's in your environment to the values that will set the NIC's to
Auto.

SpdDplx.ini
========
[14E41645]
;Broadcom NetXtreme Gigabit Ethernet (BCM5701)
;ComponentId=PCI\VEN_14E4&DEV_1645
RequestedMediaType=6

[14E41659]
;Broadcom NetXtreme Gigabit Ethernet PCI Express (BCM5750A1)
;ComponentId=PCI\VEN_14E4&DEV_1659
RequestedMediaType=6

[14E416A6]
;Broadcom NetXtreme Gigabit Ethernet (BCM5702X)
;ComponentId=PCI\VEN_14E4&DEV_16A6
RequestedMediaType=6

[14E41644]
;Broadcom NetXtreme Gigabit Ethernet (BCM5700/5401)
;ComponentId=PCI\VEN_14E4&DEV_1644
RequestedMediaType=6

[14E41648]
;Broadcom NetXtreme Gigabit Ethernet (BCM5704)
;ComponentId=PCI\VEN_14E4&DEV_1648
RequestedMediaType=6

[14E416A7]
;Broadcom NetXtreme Gigabit Ethernet
;ComponentId=PCI\VEN_14E4&DEV_16A7
RequestedMediaType=6

[14E416C7]
;Broadcom NetXtreme Gigabit Ethernet
;ComponentId=PCI\VEN_14E4&DEV_16C7
RequestedMediaType=6

[14E416A8]
;Broadcom NetXtreme Gigabit Ethernet (BCM5704S)
;ComponentId=PCI\VEN_14E4&DEV_16A8
RequestedMediaType=6

[10B79805]
;3Com EtherLink Server 10/100 PCI (3C980C-TXM)
;ComponentId=PCI\VEN_10b7&DEV_9805
Duplexmode=FullDuplex
media=100FULL

[10B79800]
;3Com EtherLink Server 10/100 PCI (3C980B-TX)
;ComponentId=PCI\VEN_10b7&DEV_9800
Duplexmode=FullDuplex
media=100FULL

[10EC8139]
;Realtek RTL8139 Family PCI Fast Ethernet NIC
;ComponentId=PCI\VEN_10EC&DEV_8139
DuplexMode=5

[80861004]
;Intel PRO/1000 Gigabit Desktop Adapter
;ComponentId=PCI\VEN_8086&DEV_1004
SpeedDuplex=5

[80861008]
;Intel PRO/1000 Gigabit Desktop Adapter
;ComponentId=PCI\VEN_8086&DEV_1008
SpeedDuplex=5

[80861009]
;Intel PRO/1000 Gigabit Desktop Adapter
;ComponentId=PCI\VEN_8086&DEV_1009
SpeedDuplex=5

[8086100C]
;Intel PRO/1000 Gigabit Desktop Adapter
;ComponentId=PCI\VEN_8086&DEV_100C
SpeedDuplex=5

[8086100E]
;Intel PRO/1000 Gigabit Desktop Adapter
;ComponentId=PCI\VEN_8086&DEV_100E
SpeedDuplex=5

[80861010]
;Intel PRO/1000 Gigabit Desktop Adapter
;ComponentId=PCI\VEN_8086&DEV_1010
SpeedDuplex=5

[10222000]
;AMD PCNET Family Ethernet Adapter (PCI)
;ComponentId=PCI\VEN_1022&DEV_2000
EXTPHY=2

[11063106]
;VIA VT6105M Rhine III Management Adapter
;ComponentId=PCI\VEN_1106&DEV_3106
ConnectionType=2

[11063043]
;VIA VT86C100A Fast Ethernet Adapter
;ComponentId=PCI\VEN_1106&DEV_3043
ConnectionType=2

[11063065]
;VIA PCI 10/100Mb Fast Ethernet Adapter
;ComponentId=PCI\VEN_1106&DEV_3065
ConnectionType=2

[12829102]
;DAVICOM 9102-Based PCI Fast Ethernet Adapter
;ComponentId=PCI\VEN_1282&DEV_9102
ConnectionType=4

[10110009]
;DC21x4 Based Network Adapter Driver
;ComponentId=PCI\VEN_1011&DEV_0009
ConnectionType=9

[10B79200]
;3Com EtherLink XL 10/100 PCI For Complete PC Management
;ComponentId=PCI\VEN_10B7&DEV_9200
Media_type=100FULL



SetSpeed.vbs
==========
Const HKLM = &H80000002

strComputer = "."
Set fso = CreateObject("Scripting.FileSystemObject")
Set objRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &
strComputer & "\root\default:StdRegProv")
sNetPath =
"System\Currentcontrolset\Control\Class\{4D36E972-E325-11CE-BFC1-08002be10318}"

SetSpeedDuplex()

Sub SetSpeedDuplex()
Dim section, strValue, subkey, arrSubKeys

objRegistry.EnumKey HKLM, sNetPath, arrSubKeys
For Each subkey In arrSubKeys
objRegistry.GetStringvalue HKLM, sNetPath & "\" & subkey, "ComponentId",
strValue
if not isnull(strValue) then
strValue = lcase(strValue)
section = left(replace(replace(strValue, "pci\ven_", ""), "&dev_",
""), 8)
ReadDuplexIni section, subkey
end if
Next
End Sub

Sub ReadDuplexIni(section, subkey)
Dim ini, line, file

file = "spddplx.ini"
If fso.FileExists(file) Then
Set ini = fso.OpenTextFile(file, 1, False)
Do While ini.AtEndOfStream = False
line = ini.ReadLine
If lcase(line) = "[" & lcase(section) & "]" Then
line = ini.ReadLine
Do While Left(line, 1) <> "["
If left(line, 1) <> ";" and len(line) > 0 Then
UpdateReg line, subkey
End If
If ini.AtEndOfStream Then Exit Do
line = ini.ReadLine
Loop
Exit Do
End If
Loop
ini.Close
End If
End Sub

Sub UpdateReg(line, subkey)
Dim lRC

key = split(line, "=")
lRC=objRegistry.SetStringValue(HKLM, sNetPath & "\" & subkey, key(0),
key(1))
End Sub



Hope this helps,

B-Mann


 
Reply With Quote
 
Tom Ker
Guest
Posts: n/a
 
      8th Dec 2005
Thanks, B-Mann, I'll take a look at it.


 
Reply With Quote
 
gve gve is offline
New Member
Join Date: Oct 2006
Posts: 2
 
      24th Oct 2006
' VBS script that Echo's out ComponentID and driverDescriptions values
' you can use it on new computers to check if you need to update spddplx.ini
' And again thank you B-Mann

Const HKLM = &H80000002
strComputer = "."
Set fso = CreateObject("Scripting.FileSystemObject")
Set objRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
sNetPath = "System\Currentcontrolset\Control\Class\{4D36E972-E325-11CE-BFC1-08002be10318}"

SetSpeedDuplex()

' ----------------------------------------------------------------------------
Sub SetSpeedDuplex()
Dim section, strValue, subkey, arrSubKeys

' DriverDesc Values in registry that will not be listed.
NOTvalues = "RAS Async Adapter, WAN Miniport, Direct Parallel, Packet Scheduler"

strDescriptions = "DriverDescription : ComponentID to search spddplx.ini " & vbCrLf

objRegistry.EnumKey HKLM, sNetPath, arrSubKeys
For Each subkey In arrSubKeys
objRegistry.GetStringvalue HKLM, sNetPath & "\" & subkey, "ComponentId",strValue
objRegistry.GetStringvalue HKLM, sNetPath & "\" & subkey, "DriverDesc",strDriverDesc
if not isnull(strValue) then
strValue = lcase(strValue)
section = left(replace(replace(strValue, "pci\ven_", ""), "&dev_",""), 8)
strDriverDescTest = left(strDriverDesc,9)
'Check the driverDesc registry value against NOTvalues.
intMatch = InStr(NOTvalues, strDriverDescTest)
IF intMatch = 0 then
strDescriptions = strDescriptions & strDriverDesc & " : " & section & vbCrLf
End if
end if
Next
wscript.echo strDescriptions
End Sub
 
Reply With Quote
 
New Member
Join Date: Mar 2007
Posts: 2
 
      20th Mar 2007
I have been tasked with the same request. Change all known NIC's to auto. I have followed this post and am hopeful on a solution. I have added one line to the SpdDplx.ini file:

[14E4167D]

;Broadcom NetXtreme Gigabit Ethernet (BCM5750A1M)

;ComponentId=pci\ven_14e4&dev_167d&subsys_0944103c

RequestedMediaType=5

[14E41645]

;Broadcom NetXtreme Gigabit Ethernet (BCM5701)

;ComponentId=PCI\VEN_14E4&DEV_1645

RequestedMediaType=5

[14E41659]

;Broadcom NetXtreme Gigabit Ethernet PCI Express (BCM5750A1)

;ComponentId=PCI\VEN_14E4&DEV_1659

RequestedMediaType=5

[14E416A6]

;Broadcom NetXtreme Gigabit Ethernet (BCM5702X)

;ComponentId=PCI\VEN_14E4&DEV_16A6

RequestedMediaType=5

[14E41644]

;Broadcom NetXtreme Gigabit Ethernet (BCM5700/5401)

;ComponentId=PCI\VEN_14E4&DEV_1644

RequestedMediaType=5

[14E41648]

;Broadcom NetXtreme Gigabit Ethernet (BCM5704)

;ComponentId=PCI\VEN_14E4&DEV_1648

RequestedMediaType=5

[14E416A7]

;Broadcom NetXtreme Gigabit Ethernet

;ComponentId=PCI\VEN_14E4&DEV_16A7

RequestedMediaType=5

[14E416C7]

;Broadcom NetXtreme Gigabit Ethernet

;ComponentId=PCI\VEN_14E4&DEV_16C7

RequestedMediaType=5

[14E416A8]

;Broadcom NetXtreme Gigabit Ethernet (BCM5704S)

;ComponentId=PCI\VEN_14E4&DEV_16A8

RequestedMediaType=5

[10B79805]

;3Com EtherLink Server 10/100 PCI (3C980C-TXM)

;ComponentId=PCI\VEN_10b7&DEV_9805

Duplexmode=FullDuplex

media=100FULL

[10B79800]

;3Com EtherLink Server 10/100 PCI (3C980B-TX)

;ComponentId=PCI\VEN_10b7&DEV_9800

Duplexmode=FullDuplex

media=100FULL

[10EC8139]

;Realtek RTL8139 Family PCI Fast Ethernet NIC

;ComponentId=PCI\VEN_10EC&DEV_8139

DuplexMode=5

[80861004]

;Intel PRO/1000 Gigabit Desktop Adapter

;ComponentId=PCI\VEN_8086&DEV_1004

SpeedDuplex=5

[80861008]

;Intel PRO/1000 Gigabit Desktop Adapter

;ComponentId=PCI\VEN_8086&DEV_1008

SpeedDuplex=5

[80861009]

;Intel PRO/1000 Gigabit Desktop Adapter

;ComponentId=PCI\VEN_8086&DEV_1009

SpeedDuplex=5

[8086100C]

;Intel PRO/1000 Gigabit Desktop Adapter

;ComponentId=PCI\VEN_8086&DEV_100C

SpeedDuplex=5

[8086100E]

;Intel PRO/1000 Gigabit Desktop Adapter

;ComponentId=PCI\VEN_8086&DEV_100E

SpeedDuplex=5

[80861010]

;Intel PRO/1000 Gigabit Desktop Adapter

;ComponentId=PCI\VEN_8086&DEV_1010

SpeedDuplex=5

[10222000]

;AMD PCNET Family Ethernet Adapter (PCI)

;ComponentId=PCI\VEN_1022&DEV_2000

EXTPHY=2

[11063043]

;VIA VT86C100A Fast Ethernet Adapter

;ComponentId=PCI\VEN_1106&DEV_3043

ConnectionType=2

[11063065]

;VIA PCI 10/100Mb Fast Ethernet Adapter

;ComponentId=PCI\VEN_1106&DEV_3065

ConnectionType=2

[12829102]

;DAVICOM 9102-Based PCI Fast Ethernet Adapter

;ComponentId=PCI\VEN_1282&DEV_9102

ConnectionType=4

[10110009]

;DC21x4 Based Network Adapter Driver

;ComponentId=PCI\VEN_1011&DEV_0009

ConnectionType=9

[10B79200]

;3Com EtherLink XL 10/100 PCI For Complete PC Management

;ComponentId=PCI\VEN_10B7&DEV_9200

Media_type=100FULL



When I run the vbscript, I receive the following error:

Microsoft VBScript runtime error: Subscript out of range: '[number: 1]'

Line (87, 1)

The full script is as follows:

Const HKLM = &H80000002

strComputer = "."

Set fso = CreateObject("Scripting.FileSystemObject")

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

sNetPath = "System\Currentcontrolset\Control\Class\{4D36E972-E325-11CE-BFC1-08002be10318}"

SetSpeedDuplex()

Sub SetSpeedDuplex()

Dim section, strValue, subkey, arrSubKeys

objRegistry.EnumKey HKLM, sNetPath, arrSubKeys

For Each subkey In arrSubKeys

objRegistry.GetStringvalue HKLM, sNetPath & "\" & subkey, "ComponentId", strValue

if not isnull(strValue) then

strValue = lcase(strValue)

section = left(replace(replace(strValue, "pci\ven_", ""), "&dev_", ""), 8)

ReadDuplexIni section, subkey

end if

Next

End Sub

Sub ReadDuplexIni(section, subkey)

Dim ini, line, file

file = "SpdDplx.ini"

If fso.FileExists(file) Then

Set ini = fso.OpenTextFile(file, 1, False)

Do While ini.AtEndOfStream = False

line = ini.ReadLine

If lcase(line) = "[" & lcase(section) & "]" Then

line = ini.ReadLine

Do While Left(line, 1) <> "["

If left(line, 1) <> ";" and len(line) > 0 Then

UpdateReg line, subkey

End If

If ini.AtEndOfStream Then Exit Do

line = ini.ReadLine

Loop

Exit Do

End If

Loop

ini.Close

End If

End Sub

Sub UpdateReg(line, subkey)

Dim lRC

key = split(line, "=")

lRC=objRegistry.SetStringValue(HKLM, sNetPath & "\" & subkey, key(0), key(1))

End Sub


Any help would be GREATLY appreciated.
 
Reply With Quote
 
New Member
Join Date: Mar 2007
Posts: 2
 
      20th Mar 2007
Thanks for getting back to me......

In the registry, I have:

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009]
"TxPacketDescCnt"="200"
"RxStdDescCnt"="200"
"RxCoalescingTicks"="10"
"TxCoalescingTicks"="30"
"RxMaxCoalescedFrames"="5"
"TxMaxCoalescedFrames"="200"
"ClockControl"="1"
"Characteristics"=dword:00000084
"BusType"="5"
"ComponentId"="pci\\ven_14e4&dev_167d&subsys_0944103c"
"Enable8021p"="0"
"FlowControlCap"="2147483648"
"LargeSendOffload"="1"
"RequestedMediaType"="6"
"TaskOffloadCap"="63"
"WakeUpModeCap"="3"
"WireSpeed"="1"
"WolSpeed"="0"
"InfPath"="oem0.inf"
"InfSection"="BCM5750A1M.XpInst"
"InfSectionExt"=".NTx86"
"ProviderName"="Broadcom"
"DriverDateData"=hex:00,00,22,37,6f,cb,c4,01
"DriverDate"="11-16-2004"
"DriverVersion"="7.80.1.0"
"MatchingDeviceId"="pci\\ven_14e4&dev_167d&subsys_0944103c"
"DriverDesc"="Broadcom NetXtreme Gigabit Ethernet"
"NetCfgInstanceId"="{76AD0FF9-2F10-48D5-9EB9-86BF0C544F32}"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Linkage]
"RootDevice"=hex(7):7b,00,37,00,36,00,41,00,44,00,30,00,46,00,46,00,39,00,2d,\
00,32,00,46,00,31,00,30,00,2d,00,34,00,38,00,44,00,35,00,2d,00,39,00,45,00,\
42,00,39,00,2d,00,38,00,36,00,42,00,46,00,30,00,43,00,35,00,34,00,34,00,46,\
00,33,00,32,00,7d,00,00,00,00,00
"UpperBind"=hex(7):44,00,4e,00,45,00,00,00,00,00
"Export"=hex(7):5c,00,44,00,65,00,76,00,69,00,63,00,65,00,5c,00,7b,00,37,00,36,\
00,41,00,44,00,30,00,46,00,46,00,39,00,2d,00,32,00,46,00,31,00,30,00,2d,00,\
34,00,38,00,44,00,35,00,2d,00,39,00,45,00,42,00,39,00,2d,00,38,00,36,00,42,\
00,46,00,30,00,43,00,35,00,34,00,34,00,46,00,33,00,32,00,7d,00,00,00,00,00
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi]
"Service"="b57w2k"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\Interfaces]
"UpperRange"="ndis5"
"LowerRange"="ethernet"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\Params]
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\Params\Enable8021p]
"ParamDesc"="802.1p QOS"
"default"="0"
"type"="enum"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\Params\Enable8021p\enum]
"0"="Disable"
"1"="Enable"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\Params\FlowControlCap]
"ParamDesc"="Flow Control"
"default"="2147483648"
"type"="enum"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\Params\FlowControlCap\enum]
"0"="Disable"
"1"="Rx PAUSE"
"2"="Tx PAUSE"
"3"="Rx/Tx PAUSE"
"2147483648"="Auto"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\Params\LargeSendOffload]
"ParamDesc"="Large Send Offload"
"default"="1"
"type"="enum"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\Params\LargeSendOffload\enum]
"0"="Disable"
"1"="Enable"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\Params\NetworkAddress]
"ParamDesc"="Locally Administered Address"
"Default"=""
"type"="edit"
"LimitText"="12"
"UpperCase"="1"
"optional"="1"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\Params\RequestedMediaType]
"ParamDesc"="Speed & Duplex"
"default"="0"
"type"="enum"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\Params\RequestedMediaType\enum]
"0"="Auto"
"3"="10 Mb Half"
"4"="10 Mb Full"
"5"="100 Mb Half"
"6"="100 Mb Full"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\Params\TaskOffloadCap]
"ParamDesc"="Checksum Offload"
"default"="63"
"type"="enum"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\Params\TaskOffloadCap\enum]
"0"="None"
"42"="Rx TCP/IP Checksum"
"21"="Tx TCP/IP Checksum"
"63"="Tx/Rx TCP/IP Checksum"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\Params\WakeUpModeCap]
"ParamDesc"="Wake Up Capabilities"
"default"="3"
"type"="enum"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\Params\WakeUpModeCap\enum]
"0"="None"
"1"="Magic Packet"
"2"="Wake Up Frame"
"3"="Both"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\Params\WireSpeed]
"ParamDesc"="Ethernet@WireSpeed"
"default"="1"
"type"="enum"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\Params\WireSpeed\enum]
"0"="Disable"
"1"="Enable"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\Params\WolSpeed]
"ParamDesc"="WOL Speed"
"default"="0"
"type"="enum"
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0009\Ndi\Params\WolSpeed\enum]
"0"="Auto"
"1"="10 Mb"
"2"="100 Mb"

Basedd on this information, is the line in the ini right? Do I need to remove the ";"?

Do we know who B-Mann is?
 
Reply With Quote
 
gve gve is offline
New Member
Join Date: Oct 2006
Posts: 2
 
      23rd Mar 2007
Try to edit your ini file. Delete the last blank line and create new one. (due to end of file information)

Do NOT delete the ;

lines in .ini file starting with ; are ignored... in the script.
Its only NIC information.

Last edited by gve; 23rd Mar 2007 at 01:27 PM..
 
Reply With Quote
 
New Member
Join Date: Jul 2007
Posts: 2
 
      26th Jul 2007
(E-Mail Removed)

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 Br
oadcom 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
 
Reply With Quote
 
New Member
Join Date: Jul 2007
Posts: 2
 
      26th Jul 2007
(E-Mail Removed)

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 Br
oadcom 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
 
Reply With Quote
 
New Member
Join Date: Dec 2007
Posts: 6
 
      11th Dec 2007
...
We had a problem with Broadcom and Intel networkcards when we connected the nics via a Netgear switch to our core switches.

When the Intel Nic portspeed was set to 100FULL DUPLEX the Netgear switched to half duplex and alot of collisions, crc's occured.
But the Broadcoms had another problem, the portspeed of the Netgear switches didn't go 100FDX but half, so needed to set these to 100FDX.

I made a script with a ini settings file, and gave it to a college for testing.
But some days later he gave me a reply that I got the script from this forum... So I looked it up and strangely it is almost the same... scary

I removed some comments because the were in Dutch language, but really wanted to share this information/ script...

net_sds.vbs
Code:
 
Option Explicit
' ================================================================================================================
' NET_SDS: Network SpeedDuplex Settings
' Auteur: Dennis van Velzen
' Datum: 06-12-2007
' Update op dit script naar aanleiding van Problem #535
' Geschreven in Notepad ++ (VB / ANSI)
' Versie: V1.00
' ================================================================================================================
'DEBUG MODE
Const Debugmode = 1 
Const HKLM = &H80000002
Dim WshShell, WshNetwork, WshFSO, WshUsrEnv, strComputer, objItem, inputFile, sNetPath
Dim objWMIService, objWMIRegistry, colItems
CreerObjecten()
'DEBUG MODE
If Debugmode = 1 Then
Debugmode_ShowNetworkadapters()
Debugmode_BestaatSettingFile()
End If
Set_SpeedDuplex()
RuimOp()
Sub Debugmode_BestaatSettingFile
If BestaatSettingsFile = True Then 
Wscript.Echo "Settings bestand (" & inputFile & ") is gevonden."
Else
Wscript.Echo "Settings bestand (" & inputFile & ") is NIET gevonden."
End If
End Sub
Sub Debugmode_ShowNetworkadapters
For Each objItem in colItems
Wscript.Echo "Apparaat nr. " & objItem.DeviceID & vbCrLf & _
"Omschrijving: " & objItem.Description & vbCrLf & _
"Hardware adres: " & objItem.MACAddress & vbCrLf & _
"PNPDeviceID: " & objItem.PNPDeviceID & vbCrLf & vbCrLf & _
"Bovenstaande omschrijving en PNPDeviceID worden gebruikt in het" & vbCrLf & _
"settings bestand. Echter heeft dit systeem genoeg aan " & _
formatRegistryKey(objItem.PNPDeviceID) & "."
Next
End Sub
Sub Set_SpeedDuplex()
Dim sectie, strWaarde, subsleutel, arrSubsleutels
objWMIRegistry.EnumKey HKLM, sNetPath, arrSubsleutels
For Each subsleutel In arrSubsleutels
objWMIRegistry.GetStringvalue HKLM, sNetPath & "\" & subsleutel, "ComponentId", strWaarde
If not isnull(strWaarde) then
sectie = formatRegistryKey(strWaarde)
LeesSettingsBestand sectie, subsleutel
End if
Next
End Sub
Sub LeesSettingsBestand(sectie, subsleutel)
Dim ini, lijn, file
file = inputFile
If BestaatSettingsFile = True Then
Set ini = wshFSO.OpenTextFile(file, 1, False)
Do While ini.AtEndOfStream = False
lijn = ini.ReadLine
If lcase(lijn) = "[" & lcase(sectie) & "]" Then
lijn = ini.ReadLine
Do While Left(lijn, 1) <> "["
If left(lijn, 1) <> ";" and len(lijn) > 0 Then
WijzigRegister lijn, subsleutel
End If
If ini.AtEndOfStream Then Exit Do
lijn = ini.ReadLine
Loop
Exit Do
End If
Loop
ini.Close
Else
End If 
End Sub
Sub WijzigRegister(lijn, subsleutel)
Dim lRC, sleutel
sleutel = split(lijn, "=")
lRC=objWMIRegistry.SetStringValue(HKLM, sNetPath & "\" & subsleutel, sleutel(0), sleutel(1))
End Sub
Function BestaatSettingsFile
BestaatSettingsFile = False
On Error Resume Next
If WshFSO.FileExists(inputFile) Then 
BestaatSettingsFile = True
End If
End Function
Function formatRegistryKey(strWaarde)
formatRegistryKey = ""
On Error resume next
strWaarde = lcase(strWaarde)
strWaarde = replace(strWaarde, "pci\ven_", "")
strWaarde = replace(strWaarde, "&dev_","")
strWaarde = left(strWaarde, 8)
formatRegistryKey = strWaarde
End Function
Sub CreerObjecten()
' Instellingen
inputFile = "settings.ini"
' Deze computer
strComputer = "."
 
' Locatie van netwerk hardware in het register
sNetPath = "System\Currentcontrolset\Control\Class\{4D36E972-E325-11CE-BFC1-08002be10318}"
' Maak WMI objecten aan
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objWMIRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
' Query WMI win32 netwerkadapters
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter",,48)
Set WshShell = WScript.CreateObject("Wscript.Shell")
Set WshNetwork = WScript.CreateObject("Wscript.Network")
Set WshFSO = Wscript.CreateObject("Scripting.FileSystemObject")
Set WshUsrEnv = WshShell.Environment("USER")
End Sub
Sub RuimOp()
Set objItem = Nothing
Set objWMIService = Nothing
Set colItems = Nothing
Set WshFSO = Nothing
Set WshNetwork = Nothing
Set WshShell = Nothing 
Set WshUsrEnv = Nothing
 
End Sub
settings.ini
Code:
 
[14E41677]
;Broadcom NetXtreme Gigabit Ethernet (HP dc7100SFF)
;ComponentId=PCI\VEN_14E4&DEV_1677
RequestedMediaType=6
SpeedDuplex=4
[14E41600]
;Broadcom NetXtreme Gigabit Ethernet (HP dc7600SFF)
;ComponentId=PCI\VEN_14E4&DEV_1600
RequestedMediaType=6
SpeedDuplex=4
[8086104A]
;Intel(r) 82566DM Gigabit Network Connection (HP dc7700SFF)
;ComponentId=PCI\VEN_8086&DEV_104A
RequestedMediaType=6
SpeedDuplex=0
Have fun with it... Regards, Dennis
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing NIC Speed/Duplex using GP Hasund Microsoft Windows 2000 Group Policy 1 29th Jun 2005 12:42 PM
Changing the speed and Duplex mode of NIC =?Utf-8?B?SmFyZWQ=?= Microsoft Windows 2000 2 13th Oct 2004 08:35 PM
Re: changing nic speed/duplex remotely Runlong Windows XP Security 0 21st May 2004 05:39 PM
Link speed and duplex Mike Pilgrim Windows XP Setup 0 7th Jan 2004 08:35 PM
Remotely changing Link Speed and Duplex bill Microsoft Windows 2000 1 5th Aug 2003 11:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:01 AM.