Petri.co.il forums by Daniel Petri  

Petri.co.il forums Home Forums Start Page Forums Frequently Asked Questions FAQ Member List Members List
Go Back   Petri.co.il forums by Daniel Petri > Other > Misc
Petri.co.il is happy to award Virtual the title of Most Valuable Member !!!
Register Calendar Calendar Search Petri.co.il forums by Daniel Petri Search Today's Posts Mark Forums Read

Notices

IDEALSTOR
How to show network card speed/duplex setting in CLI

How to show network card speed/duplex setting in CLI

this thread has 3 replies and has been viewed 13779 times

Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1  
Old 28th March 2007, 15:06
Springman Springman is offline
Casual
Casual
 
 Join Date: Mar 2007
  6 month star 12 month star
 Posts: 15
 Reputation: Springman is on a distinguished road (10)
Default How to show network card speed/duplex setting in CLI

Some of our client workstation have been hard coded to 100 full, instead of Auto long time ago by our previous network admin. I would like to change it back to Auto. It would be a pain to walk to 500 machine individually.

Is there a way that I can retrive the NIC setting with a command or registry key?
  #2  
Old 29th March 2007, 10:50
Rems's Avatar
Rems Rems is offline
Moderator
 
 Join Date: Mar 2005
  6 month star 12 month star
 Location: NL
 Posts: 1,750
 Reputation: Rems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to behold (698)
Default Re: How to show network card speed/duplex setting in CLI

I hope all 500 machines does not have to much different NIC models?

You can find, for the interfaces, the specific hardware model setting-names and -values in the #### subkeys under this registrykey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}

Create a ini file (SpdDplx.ini) for the setting per NIC you like:
eg:
Code:
[14e4165d]
;Broadcom 570x Gigabit Integrated Controller
;ComponentId=pci\ven_14e4&dev_165d&subsys_865d1028
RequestedMediaType=0

[10B79805]
;3Com EtherLink Server 10/100 PCI (3C980C-TXM)
;ComponentId=PCI\VEN_10b7&DEV_9805
Duplexmode=FullDuplex
media=AUTO
Create you own ini file by exploring the registrykey I mensioned.
The code between [square brackets] must be 8 characters long. The script needs this unique model-ID for finding the right NIC to modify in the correct registry-subkey. The id is lifted from the value of the "ComponentId" item. It is the first 4charachters after "pci\ven_" and the first 4 characters after "&dev_". The next line starting with ; is the value of DriverDesc, next line starting with ; is the complete ComponentId item. And next are/is lines without ";" these are the setting going to written to the registry.

Read more:
http://www.pcreview.co.uk/forums/sho....php?t=2278296


Then this wil be the script:
Code:
'SetNICSpeed.vbs
'URL: http://www.petri.co.il/forums/showthread.php?t=14875
'URL: http://www.pcreview.co.uk/forums/showthread.php?t=2278296
'==========

Const HKLM = &H80000002

inputFile = "spddplx.ini"

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 = chr(34)& inputFile &chr(34)
    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
In the script you must enter the right full sharedpath to the SpdDplx.ini inputFile, so you will be able to use the script as a computer_startup_script in a GPO.

\Rem

Last edited by Rems; 29th March 2007 at 11:44.. Reason: made the script better readable
  #3  
Old 29th March 2007, 15:24
Springman Springman is offline
Casual
Casual
 
 Join Date: Mar 2007
  6 month star 12 month star
 Posts: 15
 Reputation: Springman is on a distinguished road (10)
Default Re: How to show network card speed/duplex setting in CLI

Thank you so much. That's really helpful.
  #4  
Old 29th March 2007, 17:05
Rems's Avatar
Rems Rems is offline
Moderator
 
 Join Date: Mar 2005
  6 month star 12 month star
 Location: NL
 Posts: 1,750
 Reputation: Rems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to behold (698)
Default Re: How to show network card speed/duplex setting in CLI

Glad to hear.
I hope that there is not to much difference between the NIC on the 500 workstations.



Maybe some useful information about the SpdDplx.ini file;

The [8-character] ID is nesserary to reconize the vendors-id and the unique NIC-model-id to connect to the the right subkey and change the vendor specific values for that specific card in that subkey.

It appears to me (if I look at the examples in the link), that the card model-ID in the '8-character-ID' only is nessesary to tell a difference between newer and older NICs from vendor 3Com. One model is using other registry items and values then the other.
Other vendors seems always have been using a same named, and only one, item to set the speed.

So if in your case each vendor of the NIC on the workstations uses everytime the same item-name in the registry for all of its card models to set the speed value, then you be able to shorten the 8-character ID to a 3 character ID.
Then istead of the 2nd-line ";value of 'DriverDesc'" you can use the ";value of 'ProviderName'". And the 3rd-line just static information: ";LAN NIC". (the lines starting with ; are for you informationj only, these lines will be skipped by the script)

The bennefit of shorten the total ID to only the vendors unique ID is that now you have to make only one entry per vendor in the ini file, instead of per different NIC-model. That can save you a lot of time to write the ini file and collecting all the information from each computer.

When you do change the ID format in the ini file then you must! also adjust the script line: 27
section = left(replace(replace(strValue, "pci\ven_", ""), "&dev_",""), 8)
To:
section = left(replace(replace(strValue, "pci\ven_", ""), "&dev_",""), 3)


\Rem
Closed Thread


Go Back
Petri.co.il forums by Daniel Petri > Other > Misc


Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting Up Smart Card Log In jaygsy SBS 2000/2003 1 27th January 2007 22:07
Clients show up wrongly in Network Neighborhood danielp Windows 2000 Pro, XP Pro 8 18th January 2007 02:15
Network Card Teaming danny230681 DSL, Cable, and other Broadband Issues 2 6th February 2006 11:08
Setting up Windows 2003 with second Network Card impact1560 Windows Server 2000 / 2003 1 22nd April 2005 19:30
How do i setting my PC's so i can get the whole speed mongo DSL, Cable, and other Broadband Issues 4 30th November 2004 22:58



All times are GMT +3. The time now is 09:46.

Steel Blue Style vBulletin Style ©2006 vBEnhanced Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
 

Valid XHTML 1.0!   Valid CSS!

Copyright 2005 Daniel Petri