ViciousXUSMC Posted April 13, 2015 Posted April 13, 2015 (edited) I put together what looks to be a working script, I just wanted to post what I have and have some better script writings look it over to give the thumbs up or thumbs down as to how I put it together and if there was a better/smarter way to share it with me so I can learn.Background:There is a bug for the Intel i217and i218 NIC that causes the duplex to mismatch on our systems. I found an official Intel tool to fix the problem and it has a bit of info about it as well: https://downloadcenter.intel.com/download/20585/Intel-R-LAN-Driver-82579-I217-and-I218-Link-Negotiation-Process-Parameter-Change-Utility-for-WindowsToday I was approached that we have some computers in the field that are on Auto that need to be changed to 100/Full so I looked into fixing that via a registry change.While at it I wanted to go ahead and find a way to set my speed/duplex and fix the intel issue in one go.I found that my Registry keys are not completly static, a HP computer may have the intel adapter in CurrentControlSetIDXXXX007 while Dell may have CurrentControlSetIDXXX011.I found my best common ground is to look at the value of CurrentControlSetIDXXX00XDriverDesc and look for the intel adapter name, and then I can use that as the basis to apply my changes.So I needed a double loop. One to loop through the controlset key values, and another to go through the actual keys.I think since I knew a specific key I was looking for I could have worked with RegRead and skipped RegEnumVal but since the script was still blink of an eye fast I kept it working this way.The Code: #RequireAdmin Global $sKeyName = "" Global $sHKLM = "HKEY_LOCAL_MACHINE" If StringinStr(@OSArch, "64") Then $sHKLM &= "64" For $i = 0 To 20 For $i2 = 1 To 100 $sVal = $sHKLM & "\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\00" & StringFormat("%02d", $i) & "\" $sKeyName = RegEnumVal($sVal, $i2) If @Error <> 0 Then ExitLoop If StringinStr(RegRead($sVal, $sKeyName), "I217-LM") Then ;MsgBox(0, "", "Found Key") ;Key to force 100/Full Duplex RegWrite($sVal,"*SpeedDuplex", "REG_SZ", "4") ;Key to fix duplex negotiation RegWrite($sVal, "LinkNegotiationProcess", "REG_SZ", "2") EndIf ;Debug See Current Values in Loop ;MsgBox(0, "", $sVal & $sKeyName) Next Next Edited April 13, 2015 by ViciousXUSMC
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now