Good — below is a safe, copy/pasteable PowerShell script that:
- Prompts you to select the adapter (defaults to "Ethernet" if present),
- Backs up the adapter’s current advanced properties and current TCP global settings to JSON files on your Desktop,
- Attempts to apply a recommended, stable set of Realtek/2.5Gb NIC settings (disables EEE/Green, enables Flow Control, disables LSO, sets Interrupt Moderation, sets Speed & Duplex to Auto, attempts to increase buffers if the option is present),
- Applies recommended netsh TCP changes (disables autotuning/chimney for testing; saves previous settings),
- Restarts the adapter,
- Shows verification output and includes a rollback function you can run to restore everything from the backup files.
Read the notes below the script, then run it in an Administrative PowerShell session. Do not run it remotely (RDP) unless you have alternative access — adapter restart may briefly disconnect network access.
PowerShell script (run as Administrator)
- Copy everything between the triple-dashes into an elevated PowerShell window and press Enter.
Begin script
$ErrorActionPreference = "Stop"
function Prompt-SelectAdapter {
$adapters = Get-NetAdapter | Where-Object { $
.Status -ne "Disabled" } | Select-Object -Property Name, Status, LinkSpeed
if ($adapters.Count -eq 0) {
Write-Error "No network adapters found. Exiting."
exit 1
}
Write-Host "Available adapters:" -ForegroundColor Cyan
$i = 0
$adapters | ForEach-Object {
$i++
Write-Host "[$i] $($.Name) Status:$($
.Status) LinkSpeed:$($.LinkSpeed)"
}
$choice = Read-Host "Enter adapter number to configure (or press Enter to auto-select 'Ethernet' if present)"
if ([string]::IsNullOrWhiteSpace($choice)) {
if ($adapters.Name -contains "Ethernet") {
return "Ethernet"
} else {
return $adapters[0].Name
}
}
if ($choice -match '^\d+$' -and [int]$choice -ge 1 -and [int]$choice -le $adapters.Count) {
return $adapters[[int]$choice - 1].Name
} else {
Write-Error "Invalid choice. Exiting."
exit 1
}
}
function Backup-AdapterProps {
param($AdapterName, $backupPath)
$props = Get-NetAdapterAdvancedProperty -Name $AdapterName | Select-Object DisplayName, DisplayValue
$props | ConvertTo-Json -Depth 3 | Out-File -FilePath $backupPath -Encoding UTF8
}
function Restore-AdapterProps {
param($AdapterName, $backupPath)
if (-Not (Test-Path $backupPath)) { throw "Backup file not found: $backupPath" }
$json = Get-Content $backupPath -Raw | ConvertFrom-Json
foreach ($p in $json) {
$name = $p.DisplayName
$val = $p.DisplayValue
try {
Set-NetAdapterAdvancedProperty -Name $AdapterName -DisplayName $name -DisplayValue $val -ErrorAction Stop
Write-Host "Restored $name -> $val"
} catch {
Write-Warning "Could not restore $name -> $val : $_"
}
}
}
function TrySet {
param($AdapterName, $DisplayName, [string[]$Candidates)
Try candidates in order until one succeeds
Code:
foreach ($cand in $Candidates) {
try {
Set-NetAdapterAdvancedProperty -Name $AdapterName -DisplayName $DisplayName -DisplayValue $cand -ErrorAction Stop
Write-Host "Set '$DisplayName' -> '$cand'"
return $true
} catch {
# continue trying next candidate
}
}
Write-Warning "Could not set '$DisplayName' to any of: $($Candidates -join ', ')"
return $false
}
Main
$AdapterName = Prompt-SelectAdapter
Write-Host "Selected adapter: $AdapterName" -ForegroundColor Green
$desktop = [Environment]::GetFolderPath("Desktop")
$timestamp = (Get-Date).ToString("yyyyMMdd_HHmmss")
$backupAdapterFile = Join-Path $desktop "NIC_Advanced
Backup${AdapterName}_$timestamp.json"
$backupTcpFile = Join-Path $desktop "TCP_Globals
Backup$timestamp.json"
Write-Host "Backing up current adapter advanced properties to $backupAdapterFile"
Backup-AdapterProps -AdapterName $AdapterName -backupPath $backupAdapterFile
Write-Host "Backing up current netsh TCP global settings to $backupTcpFile"
$tcpBefore = netsh interface tcp show global
$tcpBefore | Out-File -FilePath $backupTcpFile -Encoding UTF8
Write-Host "Applying recommended settings..." -ForegroundColor Cyan
Desired settings map (attempts multiple common DisplayValue strings where possible)
$settings = @(
@{ Name = "Advanced EEE"; Values = @("Disabled","Off") },
@{ Name = "Energy-Efficient Ethernet"; Values = @("Disabled","Off") },
@{ Name = "EEE Max Support Speed"; Values = @("2.5 Gbps","Disabled") },
@{ Name = "Green Ethernet"; Values = @("Disabled","Off") },
@{ Name = "Gigabit Lite"; Values = @("Disabled","Off") },
@{ Name = "Flow Control"; Values = @("On","Enabled") },
@{ Name = "Large Send Offload v2 (IPv4)"; Values = @("Disabled","Off") },
@{ Name = "Large Send Offload v2 (IPv6)"; Values = @("Disabled","Off") },
@{ Name = "Large Send Offload (IPv4)"; Values = @("Disabled","Off") },
@{ Name = "Large Send Offload (IPv6)"; Values = @("Disabled","Off") },
@{ Name = "TCP Checksum Offload (IPv4)"; Values = @("Enabled","On") },
@{ Name = "TCP Checksum Offload (IPv6)"; Values = @("Enabled","On") },
@{ Name = "UDP Checksum Offload (IPv4)"; Values = @("Enabled","On") },
@{ Name = "UDP Checksum Offload (IPv6)"; Values = @("Enabled","On") },
@{ Name = "Interrupt Moderation"; Values = @("Enabled","Adaptive","On") },
@{ Name = "Recv Segment Coalescing (IPv4)"; Values = @("Enabled","On") },
@{ Name = "Recv Segment Coalescing (IPv6)"; Values = @("Enabled","On") },
@{ Name = "Speed & Duplex"; Values = @("Auto Negotiation","Auto","Auto negotiate") },
@{ Name = "Jumbo Frame"; Values = @("Disabled","Off") },
@{ Name = "Wake on Magic Packet"; Values = @("Enabled","On") }
)
foreach ($s in $settings) {
only attempt if the adapter actually has that property
Code:
$exists = Get-NetAdapterAdvancedProperty -Name $AdapterName | Where-Object { $_.DisplayName -eq $s.Name }
if ($exists) {
TrySet -AdapterName $AdapterName -DisplayName $s.Name -Candidates $s.Values
} else {
Write-Verbose "Property not present on this driver: $($s.Name)"
}
}
Attempt to set Receive/Transmit Buffers to a high value if available (common names)
$bufferAttempts = @(
@{ Name = "Receive Buffers"; Values = @("8192","4096","2048","1024") },
@{ Name = "Transmit Buffers"; Values = @("8192","4096","2048","1024") }
)
foreach ($b in $bufferAttempts) {
$exists = Get-NetAdapterAdvancedProperty -Name $AdapterName | Where-Object { $_.DisplayName -eq $b.Name }
if ($exists) {
TrySet -AdapterName $AdapterName -DisplayName $b.Name -Candidates $b.Values
} else {
Write-Verbose "Buffer property not present: $($b.Name)"
}
}
Apply netsh TCP adjustments (backup already created)
Write-Host "Saving current netsh TCP globals to backup and applying conservative TCP changes for testing..." -ForegroundColor Cyan
Write-Host "Current netsh TCP global settings (saved):" -ForegroundColor Yellow
netsh interface tcp show global
Apply changes: disable autotuning & chimney, enable RSS
Write-Host "Applying: autotuninglevel=disabled, chimney=disabled, rss=enabled" -ForegroundColor Cyan
try {
netsh int tcp set global autotuninglevel=disabled | Out-Null
netsh int tcp set global chimney=disabled | Out-Null
netsh int tcp set global rss=enabled | Out-Null
Write-Host "netsh TCP settings applied."
} catch {
Write-Warning "Failed to apply some netsh settings: $_"
}
Restart the adapter
Write-Host "Restarting adapter $AdapterName..." -ForegroundColor Cyan
try {
Disable-NetAdapter -Name $AdapterName -Confirm:$false -ErrorAction Stop
Start-Sleep -Seconds 2
Enable-NetAdapter -Name $AdapterName -Confirm:$false -ErrorAction Stop
Start-Sleep -Seconds 3
Write-Host "Adapter restarted."
} catch {
Write-Warning "Automatic restart failed; please manually Disable/Enable adapter or reboot. Error: $_"
}
Show verification
Write-Host "`nVerification: current advanced property values for $AdapterName:" -ForegroundColor Green
Get-NetAdapterAdvancedProperty -Name $AdapterName | Select-Object DisplayName, DisplayValue | Format-Table -AutoSize
Write-Host "`nVerification: current netsh TCP globals:" -ForegroundColor Green
netsh interface tcp show global
Write-Host "`nBackup files created:" -ForegroundColor Green
Write-Host " Adapter properties backup: $backupAdapterFile"
Write-Host " TCP globals backup: $backupTcpFile"
Write-Host "`nIf you want to restore the previous settings, run this command (as admin):" -ForegroundColor Yellow
Write-Host " Restore-AdapterProps -AdapterName '$AdapterName' -backupPath '$backupAdapterFile'" -ForegroundColor White
Write-Host "and to restore netsh TCP globals open the backup and manually run the previous values, or reboot to restore typical defaults." -ForegroundColor White
Write-Host "`nScript finished. Run a Windows speedtest now (browser Speedtest.net or Speedtest app) and/or run iperf3 tests to your Linux server." -ForegroundColor Cyan
End script
Notes and usage guidance
- Run as Administrator: Right-click PowerShell -> Run as Administrator.
- Adapter selection: the script will prompt you to choose the adapter. If you press Enter it will pick "Ethernet" if present.
- Backup: the script creates two files on your Desktop with timestamps:
- NIC_AdvancedBackup{Adapter}_{timestamp}.json — contains each DisplayName and its original DisplayValue (used by Restore-AdapterProps).
- TCP_GlobalsBackup{timestamp}.txt — textual output of netsh interface tcp show global.
- Rollback: To restore NIC advanced properties from backup run:
Restore-AdapterProps -AdapterName "Ethernet" -backupPath "C:\Users\<you>\Desktop\NIC_Advanced_Backup_Ethernet_YYYYMMDD_HHMMSS.json"
(You can also re-run the script and call the restore function manually.)
netsh TCP globals: the script saved the prior output; if you want to revert autotuning back to normal run:
netsh int tcp set global autotuninglevel=normal
netsh int tcp set global chimney=default
(If you want a full restore exactly as saved, open the backup text file and manually run the appropriate netsh commands shown there.)
- Buffer values: the script attempts to set Receive/Transmit buffers to common high values (8192 → 4096 → ...). If your driver has different allowed values, the Set call will fail and the script leaves the original setting intact.
- If anything goes wrong: reboot will return many driver parameters to a stable state; you also have the JSON backup to restore the original advanced values.
After running
1) Run a Speedtest (browser or Speedtest app). Report download/upload numbers and whether connectivity is stable over several attempts.
2) If you use iperf3, run single-stream and multi-stream tests to your Linux box and paste results.
3) If you want, paste the output of:
Get-NetAdapterAdvancedProperty -Name "Ethernet" | Format-Table DisplayName, DisplayValue -AutoSize
netsh interface tcp show global
and I’ll interpret anything unusual or suggest next steps (driver reinstall, Wireshark capture, etc).
Would you like me to also produce a shorter “rollback-only” script that restores both NIC props and netsh TCP values automatically (if you confirm the exact netsh backup format)?