Solved

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

Posted on 2013-11-09
8
17,192 Views
Last Modified: 2013-12-03
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
0
Comment
Question by:Sathishm82
  • 4
  • 3
8 Comments
 
LVL 14

Expert Comment

by:Giovanni Heward
ID: 39636574
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
 
LVL 14

Assisted Solution

by:Ram Balachandran
Ram Balachandran earned 500 total points
ID: 39636584
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
 
LVL 14

Expert Comment

by:Ram Balachandran
ID: 39636587
Save as batch file and run for remote computer as below

 NICSPEED.BAT  [ remote_computer ]

Open in new window

0
 

Author Comment

by:Sathishm82
ID: 39647118
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 14

Expert Comment

by:Ram Balachandran
ID: 39647597
0
 

Author Comment

by:Sathishm82
ID: 39652717
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
 
LVL 14

Accepted Solution

by:
Ram Balachandran earned 500 total points
ID: 39654089
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
 

Author Comment

by:Sathishm82
ID: 39694750
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

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Redirected folders in a windows domain can be quite useful for a number of reasons, one of them being that with redirected application data, you can give users more seamless experience when logging into different workstations.  For example, if a use…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now