# This script optimizes Network Adapters (Ethernet & Wi-Fi) and Windows OS/Kernel network settings.
# TIP: Run this script immediately after a Windows Network Reset or a major Feature Update to restore maximum performance.
# Note: Scripts from MysticFoxDE (designed to revert bad TCP tweaks back to default Windows behavior)
# are obsolete here, as this custom script completely bypasses OS defaults to lock the hardware,
# power plans, and kernel into an exclusive, high-performance state required for BBRv2.
$Properties = @{
# ---- OPTIMIZATIONS (disable power saving and timing delays) ----
"*FlowControl" = "0" # "Disabled"
"*EEE" = "0" # Energy Efficient Ethernet / IEEE 802.3az (LPI)
AdvancedEEE = "0" # Realtek Advanced EEE
"*GreenGbe" = "0" # "Disabled"
EnableGreenEthernet = "0" # Realtek Green Ethernet
"*PowerSavingMode" = "0" # "Disabled"
PowerSavingMode = "0" # "Disabled"
EnableExtraPowerSaving = "0" # Realtek Idle power saving
"*PriorityVLANTag" = "0" # "Disabled"
GigaLite = "0" # Realtek Giga Lite
"*RscIPv4" = "0" # Receive Segment Coalescing (RSC)
"*RscIPv6" = "0" # "Disabled"
"*PacketCoalescing" = "0" # "Disabled"
RoamAggressiveness = "0" # "1. Lowest" (prevent ping-spikes), on Intel Wi-Fi
MIMOPowerSaveMode = "3" # "No SMPS" (keep all antennas on), on Intel Wi-Fi
# ---- COMPULSORY DEFAULTS (restore back to modern Windows defaults) ----
"*JumboPacket" = "1514" # keep Jumbo Frames at default
"*InterruptModeration" = "1" # keep enabled to prevent extreme CPU-overhead by net-traffic
"*IPChecksumOffloadIPv4" = "3" # keep at "Rx & Tx Enabled" (keep hardware acceleration enabled)
"*TCPChecksumOffloadIPv4" = "3" # keep at "Rx & Tx Enabled"
"*TCPChecksumOffloadIPv6" = "3" # keep at "Rx & Tx Enabled"
"*UDPChecksumOffloadIPv4" = "3" # keep at "Rx & Tx Enabled"
"*UDPChecksumOffloadIPv6" = "3" # keep at "Rx & Tx Enabled"
ThroughputBoosterEnabled = "0" # keep disabled to prevent packet loss and jitter on other devices)
FatChannelIntolerant = "0" # keep disabled to prevent the card from limiting Wi-Fi bandwidth (40/80 MHz) whereby it halves its speed
uAPSDSupport = "0" # keep disabled - Unscheduled Automatic Power Save Delivery (U-APSD), on Intel Wi-Fi
}
$Names = Get-NetAdapterAdvancedProperty -ErrorAction SilentlyContinue | ForEach-Object {
if ($_.RegistryValue -and $Properties[$_.RegistryKeyword] -and $Properties[$_.RegistryKeyword] -ne $_.RegistryValue[0]) {
Set-NetAdapterAdvancedProperty -Name $_.Name -RegistryKeyword $_.RegistryKeyword -RegistryValue $Properties[$_.RegistryKeyword] -NoRestart -ErrorAction SilentlyContinue
$_.Name
} elseif (-not $_.NumericParameterMaxValue) {
return
}
$MaxLimit = if ($_.RegistryKeyword -in 'PendingReceives', 'PendingTransmits') {
[math]::Min($_.NumericParameterMaxValue, 64).ToString()
} elseif ($_.RegistryKeyword -in "*ReceiveBuffers", "*TransmitBuffers", "ReceiveBufferLen", "TransmitBufferLen") {
$_.NumericParameterMaxValue
} else {
return
}
if ($MaxLimit -and $_.RegistryValue -and $MaxLimit -ne $_.RegistryValue[0]) {
Set-NetAdapterAdvancedProperty -Name $_.Name -RegistryKeyword $_.RegistryKeyword -RegistryValue $MaxLimit -NoRestart -ErrorAction SilentlyContinue
$_.Name
}
} | Select-Object -Unique
if ($Names) {
Restart-NetAdapter -Name $Names -ErrorAction SilentlyContinue
}
# disable Power Management on all network adapters (only on systems that support S3 Legacy Standby as opposed to support Modern Standby)
Disable-NetAdapterPowerManagement -Name * -ErrorAction SilentlyContinue
# disable Power Management on all USB Controller devices (only on systems that support S3 Legacy Standby as opposed to support Modern Standby)
$usb = (Get-PNPDevice -Class USB).InstanceId
Get-CimInstance -ClassName MSPower_DeviceEnable -Namespace root\wmi -Filter "Enable=true" | Where-Object { $_.InstanceName -replace '_0$' -in $usb } | Set-CimInstance -Property @{Enable = $false} -ErrorAction SilentlyContinue
# disable USB selective suspend
powercfg /setacvalueindex scheme_current 2a737441-1930-4402-8d77-b2bebba308a3 48e6b7a6-50f5-4782-a5d4-53bb8f07e226 0
powercfg /setdcvalueindex scheme_current 2a737441-1930-4402-8d77-b2bebba308a3 48e6b7a6-50f5-4782-a5d4-53bb8f07e226 0
# disable USB 3 Link Power Mangement
powercfg /setacvalueindex scheme_current 2a737441-1930-4402-8d77-b2bebba308a3 d4e98f31-5ffe-4ce1-be31-1b38b384c009 0
powercfg /setdcvalueindex scheme_current 2a737441-1930-4402-8d77-b2bebba308a3 d4e98f31-5ffe-4ce1-be31-1b38b384c009 0
# apply changes
powercfg /setactive scheme_current
# IMPORTANT NOTE: netsh is deprecated so that's why all the below netsh commands are commented out, as they are replaced with PowerShell commands (see further down below).
# However, there are a few exceptions to this, as some netsh commands cannot be replaced, and, some others can be replaced on Windows Server, but not on Windows 11.
# These outdated netsh commands are included here just for the sake of reference / strictly informational, in case someone might still want them for whatever the reason.
# enable RSS
# netsh int tcp set global rss=enabled
# disable RSC
# netsh int tcp set global rsc=disabled
# disabling Packet Coalescing Filter is not possible with netsh
# disable TCP Heuristics
# netsh int tcp set heuristics disabled
# enable TCP Pacing
# netsh int tcp set global pacingprofile=always
# enable ECN Capability
# netsh int tcp set global ecncapability=enabled
# set Auto Tuning Level to Normal
# netsh int tcp set global autotuninglevel=normal
# switch from CUBIC to BBR2 for the Internet template
# netsh int tcp set supplemental template=Internet CongestionProvider=bbr2
# localhost bugfix
# netsh int ipv4 set gl loopbacklargemtu=disable
# netsh int ipv6 set gl loopbacklargemtu=disable
# check if the Internet template now uses BBR2
# netsh int tcp show global
# netsh int tcp show supplemental
# ----------------------------------------------------------------------------------------------------------------------------------------------------------------
# disable global kernel-offload RSC (to prevent micro-stutter in the kernel), and disable Packet Coalescing Filter (for exact BBR2 timing), but keep Receive Side Scaling (RSS) enabled
Set-NetOffloadGlobalSetting -ReceiveSegmentCoalescing Disabled -PacketCoalescingFilter Disabled -ReceiveSideScaling Enabled -ErrorAction SilentlyContinue
# disable TCP Heuristics
netsh int tcp set heuristics disabled
# enable global TCP Pacing (essential for BBR2 -> cannot be done via Set-NetTCPSetting!)
netsh int tcp set global pacingprofile=always
# enable global ECN Capability (so BBRv2 receives early network signals)
netsh int tcp set global ecncapability=enabled
# force crucial performance defaults (keep Auto Tuning Level at Normal, and keep Initial Retransmission Timeout at 1000ms)
netsh int tcp set global autotuninglevel=normal
netsh int tcp set global initialrto=1000
# switch the Congestion Control Provider from CUBIC (default) to BBR2 for the Internet template
netsh int tcp set supplemental template=Internet CongestionProvider=bbr2
# LOCALHOST BUGFIX (disable Loopback Large MTU)
Set-NetIPInterface -InterfaceAlias *Loopback* -LargeMtu Disabled -ErrorAction SilentlyContinue
# VERIFICATION: Show the final status as pure PowerShell-objects. Then show the Global template settings.
Get-NetAdapterAdvancedProperty | Select-Object Name, RegistryKeyword, DisplayName, DisplayValue, RegistryValue, ValidRegistryValues, NumericParameterMaxValue | Format-Table -AutoSize
Get-NetOffloadGlobalSetting
Get-NetTCPSetting -SettingName Internet | Select-Object SettingName, EcnCapability, AutoTuningLevelLocal, Timestamps, InitialRto | Format-Table -AutoSize
Get-NetTCPSetting -SettingName Internet | Select-Object SettingName, CongestionProvider | Format-Table -AutoSize
Get-NetIPInterface -InterfaceAlias *Loopback* | Select-Object InterfaceAlias, AddressFamily, LargeMtu | Format-Table -AutoSize
netsh int tcp show global