Command to find Nic card speed and duplex settings on Windows server 2003/2008

Hi,

Command to find Nic card speed and duplex settings, since all servers in our environmnet are configured as "Auto Negotiate". I need to verify the speed/duplex the server is connecting from server end.

Thanks
Sathish
Sathishm82Asked:
Who is Participating?
 
Ram BalachandranConnect With a Mentor Commented:
HI Sathish,

Unfortunately, each NIC will have it's Network Speed and Duple mode referenced in a different way so you will have to check each model. E.g On a Dell GX260 they are "Duplexmode"="FullDuplex" and "MediaSelect"="100BASETX", other Dell's are "SpeedDuplex"="4".

Most machines will need a reboot to make the change

In your case Speedduplex = 0 and it means it is auto.

You might need to go through each hardware manufactures catalog to see how it is defined, Windows is reading the ini file [ driver/configuration  file] to show in GUI.

I am attaching one more script to get the all possible network adapter settings using script, anything beyond need to customized and it can differ from manufacturer.



On Error Resume Next

strComputer = "."

Set objWMIService = GetObject("winmgmts:"    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery _
    ("Select * from Win32_NetworkAdapterConfiguration")

For Each objItem in colItems
    Wscript.Echo "ARP Always Source Route: " & objItem.ArpAlwaysSourceRoute
    Wscript.Echo "ARP Use EtherSNAP: " & objItem.ArpUseEtherSNAP
    Wscript.Echo "Caption: " & objItem.Caption
    Wscript.Echo "Database Path: " & objItem.DatabasePath
    Wscript.Echo "Dead GW Detection Enabled: " & objItem.DeadGWDetectEnabled
    Wscript.Echo "Default IP Gateway: " & objItem.DefaultIPGateway
    Wscript.Echo "Default TOS: " & objItem.DefaultTOS
    Wscript.Echo "Default TTL: " & objItem.DefaultTTL
    Wscript.Echo "Description: " & objItem.Description
    Wscript.Echo "DHCP Enabled: " & objItem.DHCPEnabled
    Wscript.Echo "DHCP Lease Expires: " & objItem.DHCPLeaseExpires
    Wscript.Echo "DHCP Lease Obtained: " & objItem.DHCPLeaseObtained
    Wscript.Echo "DHCP Server: " & objItem.DHCPServer
    Wscript.Echo "DNS Domain: " & objItem.DNSDomain
    Wscript.Echo "DNS Domain Suffix Search Order: " &         objItem.DNSDomainSuffixSearchOrder
    Wscript.Echo "DNS Enabled For WINS Resolution: " &         objItem.DNSEnabledForWINSResolution
    Wscript.Echo "DNS Host Name: " & objItem.DNSHostName
    Wscript.Echo "DNS Server Search Order: " & objItem.DNSServerSearchOrder
    Wscript.Echo "Domain DNS Registration Enabled: " &         objItem.DomainDNSRegistrationEnabled
    Wscript.Echo "Forward Buffer Memory: " & objItem.ForwardBufferMemory
    Wscript.Echo "Full DNS Registration Enabled: " &         objItem.FullDNSRegistrationEnabled
    Wscript.Echo "Gateway Cost Metric: " & objItem.GatewayCostMetric
    Wscript.Echo "IGMP Level: " & objItem.IGMPLevel
    Wscript.Echo "Index: " & objItem.Index
    Wscript.Echo "IP Address: " & objItem.IPAddress
    Wscript.Echo "IP Connection Metric: " & objItem.IPConnectionMetric
    Wscript.Echo "IP Enabled: " & objItem.IPEnabled
    Wscript.Echo "IP Filter Security Enabled: " &         objItem.IPFilterSecurityEnabled
    Wscript.Echo "IP Port Security Enabled: " & objItem.IPPortSecurityEnabled
    Wscript.Echo "IPSec Permit IP Protocols: " & objItem.IPSecPermitIPProtocols
    Wscript.Echo "IPSec Permit TCP Ports: " & objItem.IPSecPermitTCPPorts
    Wscript.Echo "IPSec Permit UDP Ports: " & objItem.IPSecPermitUDPPorts
    Wscript.Echo "IP Subnet: " & objItem.IPSubnet
    Wscript.Echo "IP Use Zero Broadcast: " & objItem.IPUseZeroBroadcast
    Wscript.Echo "IPX Address: " & objItem.IPXAddress
    Wscript.Echo "IPX Enabled: " & objItem.IPXEnabled
    Wscript.Echo "IPX Frame Type: " & objItem.IPXFrameType
    Wscript.Echo "IPX Media Type: " & objItem.IPXMediaType
    Wscript.Echo "IPX Network Number: " & objItem.IPXNetworkNumber
    Wscript.Echo "IPX Virtual Net Number: " & objItem.IPXVirtualNetNumber
    Wscript.Echo "Keep Alive Interval: " & objItem.KeepAliveInterval
    Wscript.Echo "Keep Alive Time: " & objItem.KeepAliveTime
    Wscript.Echo "MAC Address: " & objItem.MACAddress
    Wscript.Echo "MTU: " & objItem.MTU
    Wscript.Echo "Number of Forward Packets: " & objItem.NumForwardPackets
    Wscript.Echo "PMTUBH Detect Enabled: " & objItem.PMTUBHDetectEnabled
    Wscript.Echo "PMTU Discovery Enabled: " & objItem.PMTUDiscoveryEnabled
    Wscript.Echo "Service Name: " & objItem.ServiceName
    Wscript.Echo "Setting ID: " & objItem.SettingID
    Wscript.Echo "TCPIP Netbios Options: " & objItem.TcpipNetbiosOptions
    Wscript.Echo "TCP Maximum Connect Retransmissions: " &         objItem.TcpMaxConnectRetransmissions
    Wscript.Echo "TCP Maximum Data Retransmissions: " &         objItem.TcpMaxDataRetransmissions
    Wscript.Echo "TCP NumC onnections: " & objItem.TcpNumConnections 
    Wscript.Echo "TCP Use RFC1122 Urgent Pointer: " & objItem.TcpUseRFC1122UrgentPointer
    Wscript.Echo "TCP Window Size: " & objItem.TcpWindowSize
    Wscript.Echo "WINS Enable LMHosts Lookup: " &         objItem.WINSEnableLMHostsLookup
    Wscript.Echo "WINS Host Lookup File: " & objItem.WINSHostLookupFile
    Wscript.Echo "WINS Primary Server: " & objItem.WINSPrimaryServer
    Wscript.Echo "WINS Scope ID: " & objItem.WINSScopeID
    Wscript.Echo "WINS Secondary Server: " & objItem.WINSSecondaryServer
Next

Open in new window


Regards,
Ram
0
 
Giovanni HewardCommented:
For speed:
powershell -ExecutionPolicy Bypass -NoLogo -NoProfile
get-wmiobject Win32_NetworkAdapter | foreach-object {get-wmiobject -namespace root/WMI -class MSNdis_LinkSpeed -filter "InstanceName='$($_.Name)'"} | select InstanceName,NdisLinkSpeed,Active

Open in new window


See http://blogs.technet.com/b/wincat/archive/2012/08/27/using-powershell-for-nic-configuration-tasks.aspx
0
 
Ram BalachandranConnect With a Mentor Commented:
This batch file will give the result as below

NIC   : Intel(R) Centrino(R) Wireless-N 1030
Speed : 540 Mb/s

NIC   : Realtek PCIe FE Family Controller
Speed : 1000 Mb/s

@ECHO OFF
:: Check Windows version
IF NOT "%OS%"=="Windows_NT" GOTO Syntax

:: First command line check
IF NOT "%~2"=="" GOTO Syntax

:: Thorough command line check
ECHO.%~1| FINDSTR /R /B /I /C:"[A-Z0-9_-]*$" >NUL
IF ERRORLEVEL 1 GOTO Syntax

:: Proceed
SETLOCAL ENABLEDELAYEDEXPANSION

:: Determine name of computer to be investigated
IF "%~1"=="" (
	SET Computer=%ComputerName%
) ELSE (
	SET Computer=%~1
)

:: Find the network adapter link speed
FOR /F "tokens=1* delims==" %%A IN ('WMIC.EXE /Node:"%Computer%" /NameSpace:\\root\WMI Path MSNdis_EthernetCurrentAddress Where "Active='TRUE'" Get InstanceName /Format:LIST ^| FIND "="') DO (
	REM * * * * * *  Chomp off the trailing CR/LF  * * * * * *
	FOR /F "tokens=*" %%C IN ("%%~B") DO (
		FOR /F "tokens=1* delims==" %%D IN ('WMIC.EXE /Node:"%Computer%" /NameSpace:\\root\CIMV2 Path Win32_NetworkAdapter Where "(AdapterTypeId='0' And Name='%%~C' And PhysicalAdapter='TRUE')" Get Name /Format:LIST 2^>NUL ^| FIND "="') DO (
			REM * * * * * *  Chomp off the trailing CR/LF  * * * * * *
			FOR /F "tokens=*" %%F IN ("%%~E") DO (
				FOR /F "tokens=1* delims==" %%G IN ('WMIC.EXE /Node:"%Computer%" /NameSpace:\\root\CIMV2 Path Win32_NetworkAdapter Where "(Name='%%~F' And PhysicalAdapter='TRUE' And AdapterTypeId=0)" Get Name /Format:LIST 2^>NUL ^| FIND "="') DO (
					REM * * * * * *  Chomp off the trailing CR/LF  * * * * * *
					FOR /F "tokens=*" %%I IN ("%%~H") DO (
						SET InstanceName=
						SET NdisLinkSpeed=
						SET Multiplier=k
						FOR /F "tokens=*" %%J IN ('WMIC.EXE /Node:"%Computer%" /NameSpace:\\root\WMI Path MSNdis_LinkSpeed Where "InstanceName='%%~I'" Get InstanceName^,NdisLinkSpeed /Format:LIST 2^>NUL ^| FIND "="') DO (
							REM * * * * * *  Chomp off the trailing CR/LF  * * * * * *
							FOR /F "tokens=*" %%K IN ("%%~J") DO (
								SET %%K
							)
						)
						REM * * * * * *  If over 1000 kb/s display in Mb/s  * * * * * *
						IF !NdisLinkSpeed! GTR 1000 (
							SET /A NdisLinkSpeed = !NdisLinkSpeed! + 500
							SET /A NdisLinkSpeed = !NdisLinkSpeed! / 1000
							SET Multiplier=M
						)
						REM * * * * * *  If over 1000 Mb/s display in Gb/s  * * * * * *
						IF !NdisLinkSpeed! GTR 1000 (
							SET /A NdisLinkSpeed = !NdisLinkSpeed! + 500
							SET /A NdisLinkSpeed = !NdisLinkSpeed! / 1000
							SET Multiplier=G
						)
						REM * * * * * *  Display results  * * * * * *
						ECHO NIC   : !InstanceName!
						ECHO Speed : !NdisLinkSpeed! !Multiplier!b/s
						ECHO.
					)
				)
			)
		)
	)
)

ENDLOCAL
GOTO:EOF


:Syntax
ECHO.
ECHO NICSpeed.bat,  Version 1.00 for Windows XP Professional and later
ECHO Display active Ethernet adapters' link speed
ECHO.
ECHO Usage:  NICSPEED.BAT  [ remote_computer ]
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com

Open in new window


Reference :http://www.robvanderwoude.com/files/nicspeed_xp.txt
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
Ram BalachandranCommented:
Save as batch file and run for remote computer as below

 NICSPEED.BAT  [ remote_computer ]

Open in new window

0
 
Sathishm82Author Commented:
Sorry for the delayed response

I tried NICSPEED.BAT got below output, what about duplex setting i need it mainly as speed and be seen visually in nic card status, if i am not wrong

Microsoft Windows [Version 6.3.9431]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Users\Sathish>C:\Users\Sathish\Desktop\NICSPEED.BAT
NIC   : Microsoft KM-TEST Loopback Adapter
Speed : 12 Gb/s

NIC   : VMware Virtual Ethernet Adapter for VMnet1
Speed : 1000 Mb/s

NIC   : VMware Virtual Ethernet Adapter for VMnet8
Speed : 1000 Mb/s

NIC   : Realtek PCIe GBE Family Controller
Speed : 1000 Mb/s


Any script/command to identify duplex setting when nic card is set as "Auto negotiate"
0
 
Ram BalachandranCommented:
0
 
Sathishm82Author Commented:
I did had a look on the link http://www.petri.co.il/forums/showthread.php?t=14875


I checked the registry key and able to find *SpeedDuplex value o, please refer attached screenshot. What this means any idea

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}
nicspeeddupex.JPG
0
 
Sathishm82Author Commented:
search the nic card model in registry e.g Intel(R) PRO/1000 MT Network Connection
under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\ u may get below result


HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}
goto class right click find nic card model name "Intel(R) PRO/1000 MT Network Connection"
*SpeedDuplex
0 auto negotiate
1 10 Half duplex
2 10 Full duplex
3 100 Half duplex
4 100 Full duplex
5 1000 Half duplex
6 1000 Full duplex
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.