SkillPilotAI

PowerShell NetAdapter module (2/3)

Part 2 of the NetAdapter module: the Get-NetAdapter* cmdlets that read adapter details, statistics and offload state, and the Enable- cmdlets for USO, RSC, RSS, RDMA, VMQ and SR-IOV. These are the features that decide how much CPU a server spends on networking.

214.1 Why is it used?

  • List adapters with status, MAC and link speed (Get-NetAdapter) and read driver settings, bindings, hardware info and counters.
  • Check whether offloads (checksum, LSO, USO, RSC, IPsec) are on and why not (FailureReason).
  • Turn on performance features: RSS spreads receive work over cores, RDMA/SMB Direct, QoS (DCB).
  • On Hyper-V hosts: VMQ queues per VM and SR-IOV virtual functions.

214.2 Where it runs

  • Built into Windows 10/11 and Server, PowerShell 5.1 and 7. Get- only reads; Enable- needs admin and may restart the adapter.
  • In the video the office PC only ran counts; the Get outputs shown are Microsoft docs examples; the real practical is the Linux equivalent (ip, ethtool, /sys) in Docker.

214.3 Get-NetAdapter

PowerShell
(Get-NetAdapter).Count(Get-NetAdapter -IncludeHidden).CountGet-Command -Module NetAdapter | Measure-Object(Get-Help Get-NetAdapter).Synopsis
Output
$ (Get-NetAdapter).Count5$ (Get-NetAdapter -IncludeHidden).Count20$ Get-Command -Module NetAdapter | Measure-ObjectCount    : 78$ (Get-Help Get-NetAdapter).SynopsisGet-NetAdapter [[-Name] <string[]>] [-IncludeHidden] [-Physical] [-CimSession <CimSession[]>] [-ThrottleLimit <int>] [-AsJob] [<CommonParameters>]Get-NetAdapter -InterfaceDescription <string[]> [-IncludeHidden] [-Physical] [-CimSession <CimSession[]>] [-ThrottleLimit <int>] [-AsJob] [<CommonParameters>]Get-NetAdapter -InterfaceIndex <uint32[]> [-IncludeHidden] [-Physical] [-CimSession <CimSession[]>] [-ThrottleLimit <int>] [-AsJob] [<CommonParameters>]
  • 5 visible adapters vs 20 with -IncludeHidden: Windows has many hidden adapters like WAN Miniport.
  • Filters: -Name (wildcards like "E*2"), -InterfaceDescription, -InterfaceIndex, -Physical; -CimSession for a remote server.
  • | Format-Table -View Driver shows driver version; | Format-List -Property * shows everything.
Output
PS> Get-NetAdapterName       InterfaceDescription        ifIndex Status       MacAddress        LinkSpeedEthernet   Intel(R) Ethernet I219-LM        12 Up           00-11-22-33-44-55 1 GbpsWi-Fi      Intel(R) Wi-Fi 6 AX201           18 Disconnected A4-B1-C1-11-22-33 0 bpsEthernet 2 Hyper-V Virtual Ethernet         24 Disabled     00-15-5D-01-02-03 10 Gbps

The table above is the Microsoft docs example output (Status can be Up, Disconnected or Disabled).

214.4 Adapter details: advanced properties, bindings, hardware, statistics, power

CmdletShows
Get-NetAdapterAdvancedPropertyDriver settings from the Advanced tab (Jumbo Packet...); -AllProperties, -RegistryKeyword
Get-NetAdapterBindingProtocols on the adapter (ms_tcpip = IPv4); -AllBindings shows hidden ones
Get-NetAdapterHardwareInfoRead-only PCI/MSI capabilities, bus and slot
Get-NetAdapterStatisticsBytes sent/received, broadcast, multicast, discards, errors
Get-NetAdapterPowerManagementWake on Magic Packet and sleep features (run elevated)
Get-NetAdapterDataPathConfigurationNDIS Poll Mode profile: Legacy mode, Balanced, Passive, Dispatch
PowerShell
Get-NetAdapterAdvancedProperty -Name "*" |  Where-Object -FilterScript { $_.DisplayName -Like "TCP*" }Get-NetAdapterBinding -Name "MyAdapter" -ComponentID ms_tcpipGet-NetAdapterHardwareInfo -Name "*"Get-NetAdapterStatistics -Name "MyAdapter" |  Format-List -Property "*"Get-NetAdapterPowerManagement -Name "Ethernet"Get-NetAdapterDataPathConfiguration -Name "Ethernet"

Linux equivalent (real lab): ip -s -d link, /sys/class/net, ethtool -i / -S.

Terminal
ip -s -d link show eth0cd /sys/class/net/eth0 && cat speed mtu operstateethtool -i eth0
Output
$ ip -s -d link show eth02: eth0@if1662: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default    veth addrgenmode eui64 numtxqueues 8 numrxqueues 8 gso_max_size 65536 gso_max_segs 65535 tso_max_size 524280 tso_max_segs 65535 gro_max_size 65536 gso_ipv4_max_size 65536 gro_ipv4_max_size 65536    RX:  bytes packets errors dropped  missed   mcast          1320      16      0       0       0       0    TX:  bytes packets errors dropped carrier collsns           462       7      0       0       0       0$ cd /sys/class/net/eth0 && cat speed mtu operstate100001500up$ ethtool -i eth0driver: vethversion: 1.0firmware-version:bus-info:supports-statistics: yessupports-test: no
  • RX/TX counters = Get-NetAdapterStatistics; speed 10000 (10 Gbps) and operstate up = LinkSpeed and Status.
  • ethtool -i = HardwareInfo: bus-info is empty because veth is virtual and sits in no PCI slot.

214.5 Offloads and receive scaling

NIC features on a server: RSS, RSC, checksum
  1. 1.Client downloads a file; packets go via the switch to the server NIC

  2. 2.Without RSS all packets land on one CPU core

  3. 3.RSS hashes the header and spreads traffic across several cores

  4. 4.RSC joins small segments into one big packet

  5. 5.Checksum offload: the NIC computes checksums, not the CPU

FeatureDirectionWhat it doesCmdlets
Checksum offloadBothNIC computes IPv4/TCP/UDP checksumsGet-NetAdapterChecksumOffload
LSOSendBig TCP block cut into MTU-sized frames by the NICGet-NetAdapterLso
USOSendSame as LSO for UDP datagrams larger than MTUEnable-/Get-NetAdapterUso
RSCReceiveJoins small segments into oneEnable-/Get-NetAdapterRsc
RSSReceiveSpreads receive traffic over CPU coresEnable-/Get-NetAdapterRss
Encapsulated / IPsec offloadBothOffloads on tunnel inner headers / IPsec crypto on NICGet-NetAdapterEncapsulatedPacketTaskOffload, Get-NetAdapterIPsecOffload
PowerShell
$NetworkAdapterC01 = Get-NetAdapterChecksumOffload -Name "MyAdapter"$NetworkAdapterC01.ChecksumOffloadHardwareCapabilitiesGet-NetAdapterLso -Name "*" | Where-Object -FilterScript { $_.Enabled }Enable-NetAdapterUso -Name "*" -IPv4 -IPv6Enable-NetAdapterRsc -Name "MyAdapter"Get-NetAdapterRsc -Name "*"Enable-NetAdapterRss -Name "*"Get-NetAdapterRss -Name "*" | Where-Object -FilterScript { $_.Enabled }
  • Enable-NetAdapterUso / -Rsc / -Rss restart the adapter (docs); -NoRestart prevents it.
  • Without -IPv4 / -IPv6, Enable-NetAdapterRsc enables both families.
  • Get-NetAdapterRsc FailureReason explains why RSC is off: NicPropertyDisabled, WFPCompatibility, ForwardingEnabled (PC is routing), NDISCompatibility.
Terminal
ethtool -k eth0ethtool -l eth0ethtool -x eth0ls /sys/class/net/eth0/queues
Output
$ ethtool -k eth0Features for eth0:rx-checksumming: ontx-checksumming: ontcp-segmentation-offload: ongeneric-segmentation-offload: ongeneric-receive-offload: offlarge-receive-offload: off [fixed]receive-hashing: off [fixed]tx-udp_tnl-segmentation: ontx-udp-segmentation: onesp-hw-offload: off [fixed]$ ethtool -l eth0Channel parameters for eth0:Pre-set maximums:RX:        8TX:        8Current hardware settings:RX:        1TX:        1$ ethtool -x eth0netlink error: Not supported$ ls /sys/class/net/eth0/queuesrx-0tx-0
  • Linux mapping: checksumming = checksum offload, tcp-segmentation-offload = LSO, tx-udp-segmentation = USO, large-receive-offload = RSC-like, esp-hw-offload = IPsec offload.
  • RSS on Linux = channels (ethtool -l) + indirection table (ethtool -x); veth has max 8 queues, 1 active, and no hardware hash (Not supported).

214.6 RDMA and QoS

  • RDMA copies data from one server's memory to another's without the CPU; SMB Direct on Windows Server uses it.
  • Get-NetAdapterQos shows DCB settings: traffic classes with bandwidth shares and priority flow control.
PowerShell
Enable-NetAdapterRdma -Name "*"Get-NetAdapterRdma -Name "*" | Where-Object -FilterScript { $_.Enabled }Get-NetAdapterQos -Name "*" | Where-Object -FilterScript { $_.Enabled }
Output
Name                       : DCBADAPTER1Enabled                    : TrueCapabilities               :                       Hardware     Current--------     -------MacSecBypass        : NotSupported NotSupportedDcbxSupport         : IEEE         NoneNumTCs(Max/ETS/PFC) : 8/8/8        8/8/8OperationalTrafficClasses  : TC TSA    Bandwidth Priorities-- ---    --------- ----------0  ETS           40 0-3,5-71  ETS           60 4OperationalFlowControl     : Priority 4 EnabledOperationalClassifications : Not Available

Docs example output: class 0 gets 40% bandwidth, class 1 gets 60%; flow control on priority 4 means that traffic is paused during congestion instead of dropped.

214.7 Hyper-V: VMQ, SR-IOV, VF, VPort

Hyper-V host: VMQ and SR-IOV
  1. 1.Packet for a VM arrives at the host NIC

  2. 2.VMQ: NIC hashes the destination MAC and puts each VM's packets in its own queue

  3. 3.Virtual switch has less work

  4. 4.SR-IOV: a NIC virtual function (VF) is given directly to the VM

  5. 5.Packet bypasses the software switch and reaches the VM directly

PowerShell
Enable-NetAdapterVmq -Name "GuestTrafficAdapter"Get-NetAdapterVmqQueue -Name "Guest Traffic Adapter"Enable-NetAdapterSriov -Name "Ethernet 1"Get-NetAdapterSriov -Name "*"Get-NetAdapterSriovVf -SwitchId 2Get-NetAdapterVPort -Name "Ethernet Connection 2" -VPortID 3
  • SR-IOV needs support from the NIC, motherboard and BIOS; SriovSupport = Unknown means check I/O virtualization in the BIOS.
  • Get-NetAdapterSriovVf lists VF ID, VM name and MAC; -FunctionID gives one VF in detail.
  • A VPort is a virtual port created on the adapter for SR-IOV or VMQ; -VPortID 3 shows one port in long format.

214.8 Common mistakes

  • Treating Enable-NetAdapterRss/Rsc/Uso as a harmless toggle: the adapter restarts and the connection drops for a few seconds.
  • Forgetting -IncludeHidden when counting adapters and missing hidden ones.
  • Expecting RSC on a PC that forwards packets: FailureReason will be ForwardingEnabled.
  • Expecting RSS hash or Wake on LAN on a virtual veth in Linux: Not supported.

214.9 Interview tips

  • One core at 100% during a big download, others idle: check RSS (Get-NetAdapterRss; on Linux ethtool -l and -x).
  • LSO vs RSC vs RSS: all move CPU work to the NIC; LSO cuts big blocks into frames on send, RSC joins segments on receive, RSS spreads receive traffic over cores.
  • VMQ = per-VM queues by destination MAC; SR-IOV = VF given directly to the VM, bypassing the vSwitch.
  • On production use -NoRestart and restart in a maintenance window.