Set NetTCPSetting - PowerShell


The Set-NetTCPSetting command modifies the Transmission Control Protocol (TCP) settings on a network interface. It allows administrators to configure various TCP parameters to optimize network performance and troubleshoot connectivity issues.


Set-NetTCPSetting [-AddressFamily AddressFamily] [-InterfaceAlias InterfaceAlias] [-ReceiveSegmentSizeBytes ReceiveSegmentSizeBytes] [-TcpMaxDataRetransmissions TcpMaxDataRetransmissions] [-TcpMaxSynRetransmissions TcpMaxSynRetransmissions] [-TcpTimedWaitDelay TcpTimedWaitDelay] [-TcpWindowSize ReceiveWindowSizeBytes] [-TcpWindowScalingEnabled TcpWindowScalingEnabled] [-TcpDelayedAckEnabled TcpDelayedAckEnabled] [-TcpFastOpenEnabled TcpFastOpenEnabled] [-TcpFastOpenConnectRequests TcpFastOpenConnectRequests] [-TcpFastOpenMaxDataPermitted TcpFastOpenMaxDataPermitted] [-TcpFastOpenMaxDataPermittedTcpFastOpenEnabled] [-TcpLookupTimeout TcpLookupTimeout] [-TcpMaxUserPort TcpMaxUserPort] [-TcpMaxUserPortDynamic TcpMaxUserPortDynamic] [-TcpMeasureThroughputTcpFastOpenEnabled] [-TcpPmtuDiscoveryEnabled TcpPmtuDiscoveryEnabled] [-TcpSynAttackProtectEnabled TcpSynAttackProtectEnabled] [-TcpSndBuf SendWindowSizeBytes] [-TcpSendWindowScalingEnabled TcpSendWindowScalingEnabled] [-Tcp timestampsEnabled TCPtimestampsEnabled] [-TcpUsePMTUDiscovery TcpUsePMTUDiscovery]


  • -AddressFamily: Address family for which to modify TCP settings. Valid values: IPv4 or IPv6.
  • -InterfaceAlias: Name or index of the network interface to modify.
  • -ReceiveSegmentSizeBytes: Size of received segments in bytes. Default: 65535.
  • -TcpMaxDataRetransmissions: Maximum number of data retransmissions before dropping a connection. Default: 5.
  • -TcpMaxSynRetransmissions: Maximum number of SYN retransmissions before dropping a connection. Default: 5.
  • -TcpTimedWaitDelay: Idle time for a TCP connection in the TIME_WAIT state. Default: 240 seconds.
  • -TcpWindowSize: Size of the TCP receive window in bytes. Default: 65535.
  • -TcpWindowScalingEnabled: Enable or disable TCP window scaling for large windows.
  • -TcpDelayedAckEnabled: Enable or disable TCP delayed acknowledgments.
  • -TcpFastOpenEnabled: Enable or disable TCP fast open.
  • -TcpFastOpenConnectRequests: Number of TCP fast open connect requests. Default: 10.
  • -TcpFastOpenMaxDataPermitted: Maximum amount of data allowed for a TCP fast open connection. Default: 1048576 bytes.
  • -TcpLookupTimeout: Timeout for TCP hostname lookups. Default: 15 seconds.
  • -TcpMaxUserPort: Maximum port number that a user can use. Default: 5000.
  • -TcpMaxUserPortDynamic: Enable or disable dynamic assignment of ephemeral ports.
  • -TcpMeasureThroughputTcpFastOpenEnabled: Enable or disable TCP throughput measurement.
  • -TcpPmtuDiscoveryEnabled: Enable or disable TCP path MTU discovery.
  • -TcpSynAttackProtectEnabled: Enable or disable TCP SYN flood protection.
  • -TcpSndBuf: Size of the TCP send buffer in bytes. Default: 131072.
  • -TcpSendWindowScalingEnabled: Enable or disable TCP send window scaling for large windows.
  • -TcpTimestampsEnabled: Enable or disable TCP timestamps.
  • -TcpUsePMTUDiscovery: Enable or disable TCP PMTU discovery.


Example 1: Increase TCP receive window size on IPv4

Set-NetTCPSetting -InterfaceAlias "Ethernet" -AddressFamily IPv4 -TcpWindowSize 131072

Example 2: Disable TCP fast open and enable maximum port range

Set-NetTCPSetting -InterfaceAlias "Wi-Fi" -AddressFamily IPv4 -TcpFastOpenEnabled $false -TcpMaxUserPortDynamic $true

Example 3: Enable TCP path MTU discovery and SYN attack protection

Set-NetTCPSetting -InterfaceAlias "Ethernet 2" -AddressFamily IPv6 -TcpPmtuDiscoveryEnabled $true -TcpSynAttackProtectEnabled $true

Common Issues

  • Invalid interface: Ensure that the specified network interface exists and is active.
  • Incorrect address family: Verify that the address family matches the IP address assigned to the interface.
  • Value outside of range: Make sure that parameter values are within the allowed range.


Set-NetTCPSetting can be used in conjunction with other networking commands, such as New-NetTCPConnection and Get-NetAdapter. It can be incorporated into scripts to automate network configuration tasks.

  • New-NetTCPConnection
  • Get-NetAdapter
  • Set-NetIPInterface