Anybody familiar with TCP "desuboptimization" powershell script?


schmibble

Active member
Member
Local time
2:45 PM
Posts
45
OS
Windows 11

My Computer My Computer

At a glance

Windows 11Intel i7-13620H 10-Core32GB DDR5GeForce RTX 4070
OS
Windows 11
Computer type
Laptop
Manufacturer/Model
ASUS
CPU
Intel i7-13620H 10-Core
Motherboard
ASUS TUF FX507
Memory
32GB DDR5
Graphics Card(s)
GeForce RTX 4070
Sound Card
onboard
Monitor(s) Displays
laptop screen or Dell U3223QE
Screen Resolution
1980 or 2160, depending on laptop screen or desktop monitor
Hard Drives
SSD
PSU
laptop
Case
laptop
Cooling
laptop
Keyboard
laptop
Mouse
logitech M525
Internet Speed
5g
Browser
Firefox
Windows network settings are known to not be the most optimized, but they are fine for most situations. First off if you're getting close to your advertised speed then I wouldn't bother. "If it ain't broke, don't fix it". Nothing in the script should cause you any added issues (usually....)
 

My Computer My Computer

At a glance

Linux Mint
OS
Linux Mint
Computer type
Laptop
Manufacturer/Model
System76 Lemur Pro
The first thing from a casual look is that the script at the link you posted is that it hasn't been updated in about three years.

I think there has been a few network stack patches since then.........

Hard pass from me.
 

My Computer My Computer

At a glance

Windows 11 Pro 25H2 (26200.8457)AMD Ryzen 7 7800X3D32gb Team Group (T-Force) DDR5-6000Zotac nVidia GeForce RTX 4070 SUPER - 12gb
OS
Windows 11 Pro 25H2 (26200.8457)
Computer type
PC/Desktop
Manufacturer/Model
Pre-built
CPU
AMD Ryzen 7 7800X3D
Motherboard
MSI Pro B650-VC WiFi
Memory
32gb Team Group (T-Force) DDR5-6000
Graphics Card(s)
Zotac nVidia GeForce RTX 4070 SUPER - 12gb
Sound Card
Sound BlasterX G6
Monitor(s) Displays
Koorui G2421V and ViewSonic VX2453
Screen Resolution
P:2560x1440 S:1920x1080
Hard Drives
WD Blue SN5000 - 500gb NVME
WD Blue SN580 - 2TB NVME
Seagate 4TB HDD - ST4000VN008-2DR166
Keyboard
Mountain Everest
Mouse
Logitech G502 Hero
Internet Speed
T-Mobile Home Internet
Browser
Firefox
Other Info
QNAP TS-469 Pro NAS
TP-Link W7200 (2 unit mesh network)
Elgato Streamdeck
  • Like
Reactions: OAT

My Computer My Computer

At a glance

Windows 11
OS
Windows 11

My Computer My Computer

At a glance

Microsoft Windows 11 HomeIntel Core i5-13490F2 x 16 Patriot Memory (PDP Systems) PSD516G56...GIGABYTE GeForce RTX 4070 WINDFORCE OC 12G (G...
OS
Microsoft Windows 11 Home
Computer type
PC/Desktop
Manufacturer/Model
MSI MS-7D98
CPU
Intel Core i5-13490F
Motherboard
MSI B760 GAMING PLUS WIFI
Memory
2 x 16 Patriot Memory (PDP Systems) PSD516G560081 6400MT (32-37-37-74); 1.35V)
Graphics Card(s)
GIGABYTE GeForce RTX 4070 WINDFORCE OC 12G (GV-N4070WF3OC-12GD)
Sound Card
Bluetooth Аудио
Monitor(s) Displays
INNOCN 15K1F
Screen Resolution
1920 x 1080
Hard Drives
WD_BLACK SN770 250GB
KINGSTON SNV2S1000G (ELFK0S.6)
PSU
Thermaltake Toughpower GF3 1000W
Case
CG560 - DeepCool
Cooling
ID-COOLING SE-224-XTS / 2 x 140Mm Fan - rear and top; 3 x 120Mm - front
Keyboard
Corsair K70 RGB TKL
Mouse
Corsair KATAR PRO XT
Internet Speed
100 Mbps
Browser
Firefox
Antivirus
Microsoft Defender Antivirus
Other Info
https://www.userbenchmark.com/UserRun/66553205

"network optimizer skript, non-homeopathik edition.ps1"

Powershell:
# 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
 
Last edited:

My Computers My Computers

  • At a glance

    11 Homei7 13650HX16GB DDR5GeForce RTX 4060 Mobile
    OS
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Asus TUF Gaming F16 (2024)
    CPU
    i7 13650HX
    Memory
    16GB DDR5
    Graphics Card(s)
    GeForce RTX 4060 Mobile
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    512GB SSD internal
    37TB external
    PSU
    Li-ion
    Cooling
    2× Arc Flow Fans, 4× exhaust vents, 5× heatpipes
    Keyboard
    Logitech K800
    Mouse
    Logitech G402
    Internet Speed
    30Mbit/s up, 500Mbit/s down
    Browser
    FF
    Antivirus
    What's an antivirus?
  • At a glance

    11 Homei5 1135G716GB DDR4Intel Iris Xe
    Operating System
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Medion S15450
    CPU
    i5 1135G7
    Memory
    16GB DDR4
    Graphics card(s)
    Intel Iris Xe
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    2TB SSD internal
    37TB external
    PSU
    Li-ion
    Keyboard
    Logitech K800
    Mouse
    Logitech G402
    Internet Speed
    30Mbit/s up, 500Mbit/s down
    Browser
    FF
Back
Top Bottom