Skip to content

Instantly share code, notes, and snippets.

@asheroto
Last active September 20, 2024 09:53
Show Gist options
  • Save asheroto/942db6b331db8f070472990da6e6e1db to your computer and use it in GitHub Desktop.
Save asheroto/942db6b331db8f070472990da6e6e1db to your computer and use it in GitHub Desktop.
Adjusts various TCP and network settings in Windows to enhance the speed of the Internet connection.

Most of these settings were mentioned on SpeedGuide.net and MajorGeek.com.

Medium article

Write-Output "Setting congestion provider to CTCP for Internet."
netsh int tcp set supplemental Internet congestionprovider=ctcp | Out-Null
Write-Output "Enabling Direct Cache Access, and configuring RSS and RSC settings globally."
netsh int tcp set global dca=enabled rss=enabled rsc=disabled | Out-Null
Write-Output "Disabling TCP timestamps globally."
netsh int tcp set global timestamps=disabled | Out-Null
Write-Output "Setting initial Retransmission Timeout (RTO) to 2000 milliseconds globally."
netsh int tcp set global initialRto=2000 | Out-Null
Write-Output "Disabling Non-SACK RTT Resiliency globally."
netsh int tcp set global nonsackrttresiliency=disabled | Out-Null
Write-Output "Setting maximum SYN retransmissions to 2 globally."
netsh int tcp set global maxsynretransmissions=2 | Out-Null
Write-Output "Setting dynamic port range for TCP on IPv4."
netsh int ipv4 set dynamicport tcp start=10000 num=3000 | Out-Null
Write-Output "Setting dynamic port range for TCP on IPv6."
netsh int ipv6 set dynamicport tcp start=10000 num=3000 | Out-Null
Write-Output "Disabling TCP Chimney Offload globally."
Set-NetOffloadGlobalSetting -Chimney Disabled | Out-Null
Write-Output "Enabling Checksum Offload on all network adapters."
Enable-NetAdapterChecksumOffload -Name * | Out-Null
Write-Output "Enabling Receive-Side Scaling on all network adapters."
Enable-NetAdapterRss -Name * | Out-Null
Write-Output "Disabling Receive Segment Coalescing on all network adapters."
Disable-NetAdapterRsc -Name * | Out-Null
Write-Output "Disabling Packet Coalescing Filter globally."
Set-NetOffloadGlobalSetting -PacketCoalescingFilter Disabled | Out-Null
Write-Output "Disabling Large Send Offload on all network adapters."
Disable-NetAdapterLso -Name * | Out-Null
Write-Output "Setting minimum RTO (Retransmission Timeout) to 300 milliseconds for InternetCustom profile."
Set-NetTCPSetting -SettingName InternetCustom -MinRto 300 | Out-Null
Write-Output "Setting Initial Congestion Window size to 10 segments for InternetCustom profile."
Set-NetTCPSetting -SettingName InternetCustom -InitialCongestionWindow 10 | Out-Null
Write-Output "Setting TCP AutoTuningLevel to Normal and disabling ScalingHeuristics for InternetCustom profile."
Set-NetTCPSetting -SettingName InternetCustom -AutoTuningLevelLocal Normal -ScalingHeuristics Disabled | Out-Null
Write-Output "Setting default TTL value in TCP/IP parameters to 64."
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /t REG_DWORD /v DefaultTTL /d 64 /f | Out-Null
Write-Output "Setting maximum user port number in TCP/IP parameters to 65534."
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /t REG_DWORD /v MaxUserPort /d 65534 /f | Out-Null
Write-Output "Setting TCP timed wait delay in TCP/IP parameters to 30 seconds."
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /t REG_DWORD /v TcpTimedWaitDelay /d 30 /f | Out-Null
Write-Output "Disabling non-best effort bandwidth limit in QoS policies."
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Psched" /t REG_DWORD /v NonBestEffortLimit /d 0 /f | Out-Null
Write-Output "Configuring QoS to not use Network Layer Authentication."
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\QoS" /t REG_SZ /v "Do not use NLA" /d 1 /f | Out-Null
Write-Output "Setting system memory management to use a smaller system cache."
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /t REG_DWORD /v LargeSystemCache /d 0 /f | Out-Null
Write-Output "Adjusting LanmanServer parameters for optimized file sharing performance."
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /t REG_DWORD /v Size /d 3 /f | Out-Null
Write-Output "Setting network throttling index in multimedia system profile to maximum."
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" /t REG_DWORD /v NetworkThrottlingIndex /d 4294967295 /f | Out-Null
Write-Output "Setting system responsiveness to maximum in multimedia system profile."
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" /T REG_DWORD /v SystemResponsiveness /d 0 /f | Out-Null
Write-Output "Applying NSI registry settings for network performance optimization."
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Nsi\{eb004a03-9b1a-11d4-9123-0050047759bc}\26" /v "00000000" /t REG_BINARY /d "0000000000000000000000000500000000000000000000000000000000000000ff00000000000000" /f | Out-Null
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Nsi\{eb004a03-9b1a-11d4-9123-0050047759bc}\26" /v "04000000" /t REG_BINARY /d "0000000000000000000000000500000000000000000000000000000000000000ff00000000000000" /f | Out-Null
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Nsi\{eb004a03-9b1a-11d4-9123-0050047759bc}\0" /v "0200" /t REG_BINARY /d "0000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000ff000000000000000000000000000000" /f | Out-Null
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Nsi\{eb004a03-9b1a-11d4-9123-0050047759bc}\0" /v "1700" /t REG_BINARY /d "0000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000ff000000000000000000000000000000000000000000ff000000000000000000000000000000" /f | Out-Null
Write-Output "Setting priority levels for DNS, Hosts, Local, and NetBT services."
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\ServiceProvider" /v "DnsPriority" /t REG_DWORD /d "6" /f | Out-Null
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\ServiceProvider" /v "HostsPriority" /t REG_DWORD /d "5" /f | Out-Null
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\ServiceProvider" /v "LocalPriority" /t REG_DWORD /d "4" /f | Out-Null
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\ServiceProvider" /v "NetbtPriority" /t REG_DWORD /d "7" /f | Out-Null
Write-Output "Setting IRPStackSize for LanmanServer to enhance file sharing capabilities."
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /t REG_DWORD /v IRPStackSize /d 30 /f | Out-Null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment