Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
To automate a local Windows network-stack reset, run an elevated PowerShell script that executes netsh winsock reset, netsh int ip reset, ipconfig /release, and ipconfig /renew in that order. Add ipconfig /flushdns only when stale DNS data is part of the symptom. The script should record each command, exit code, and result, warn about DHCP and static-interface differences, then verify the adapter configuration and connectivity. Plan a restart: Microsoft’s documented TCP/IP reset workflow includes restarting Windows, and netsh int ip reset can require it.
This procedure repairs software state on the computer; it does not improve a weak Wi-Fi signal, replace a faulty cable, repair an ISP outage, or fix every driver problem. If the reset does not restore service, move from configuration checks to the adapter driver and, for persistent application or timeout failures, packet capture.
As an Amazon Associate I earn from qualifying purchases.
Recommended Free Tools
What does a PowerShell IP-stack reset actually change?
A reset is not one operation. Each command targets a different layer of Windows networking, so using the smallest operation that matches the symptom avoids unnecessary disruption.
| Command or action | Layer affected | Best fit | Disruption and evidence |
|---|---|---|---|
netsh winsock reset |
Winsock catalog and layered service providers | Applications that cannot connect even though the adapter appears configured; corruption caused by an unwanted or broken network component | Resets the catalog to a clean state and removes custom LSPs. Record its output and exit code; a restart is commonly used to complete the repair. |
netsh int ip reset <log-file> |
TCP/IP-related configuration | Suspected corruption in the Windows TCP/IP stack | Microsoft describes it as having the same effect as removing and reinstalling TCP/IP. It writes actions to a reset log and may require a restart. |
ipconfig /release followed by ipconfig /renew |
DHCP lease on eligible adapters | Stale, missing, or incorrect DHCP addressing | Connectivity drops while the lease is released. Static interfaces do not use DHCP, so the command may fail or have no useful effect. |
ipconfig /flushdns |
Local DNS resolver cache | DNS-only symptoms, such as a name failing while a known IP address works | Clears cached answers without changing the adapter’s IP configuration. Use it deliberately rather than on every run. |
The sequence is useful because it proceeds from application-facing Winsock state to the TCP/IP configuration and then to address leasing. DNS cache clearing is separate and should be enabled only when the evidence points to name-resolution state.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
How do I prepare before running the automation?
Open Windows PowerShell or PowerShell 7 with Run as administrator. Microsoft’s TCP/IP reset procedure requires an administrator account; a non-elevated session should be rejected before any command changes the system.
Record settings that may matter after the reset
- Run
Get-NetIPConfigurationand save the output if the computer has static addresses, custom DNS servers, VPN software, or manually configured routes. - Note the adapter name, IPv4 address, default gateway, and DNS servers. DHCP users normally receive these again after renewal; static users may need to re-enter them if configuration is changed.
- Close applications that depend on the network. Releasing a DHCP lease interrupts active connections, and the full reset can require a restart.
- If this is a remote computer, arrange an out-of-band console or someone local. A reset can terminate the remote session before the script reaches its verification stage.
What PowerShell script automates the documented sequence?
The following script checks elevation, captures the host and adapter context, logs every command and exit code, runs the commands in order, makes DNS flushing optional, and performs a post-reset check. Save it as Reset-LocalNetworkStack.ps1, then run it from an elevated console.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →[CmdletBinding()]
param(
[switch]$FlushDns
)
$ErrorActionPreference = 'Continue'
$started = Get-Date
$logPath = Join-Path $env:TEMP ("network-reset-{0:yyyyMMdd-HHmmss}.log" -f $started)
$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = [Security.Principal.WindowsPrincipal]::new($identity)
$adminRole = [Security.Principal.WindowsBuiltInRole]::Administrator
if (-not $principal.IsInRole($adminRole)) {
throw "Run this script from an elevated PowerShell window (Run as administrator)."
}
function Write-Log {
param([string]$Message)
$line = "{0:u} {1}" -f (Get-Date), $Message
Add-Content -LiteralPath $logPath -Value $line
Write-Host $line
}
function Invoke-NetworkCommand {
param(
[Parameter(Mandatory)] [string]$FilePath,
[Parameter(Mandatory)] [string[]]$Arguments
)
$display = ($Arguments -join ' ')
Write-Log ("COMMAND: {0} {1}" -f $FilePath, $display)
$output = & $FilePath @Arguments 2>&1
$exitCode = $LASTEXITCODE
foreach ($line in $output) {
Write-Log ("OUTPUT: {0}" -f $line)
}
Write-Log ("EXIT CODE: {0}" -f $exitCode)
return $exitCode
}
Write-Log ("Host: {0}" -f $env:COMPUTERNAME)
Write-Log ("PowerShell: {0}" -f $PSVersionTable.PSVersion)
Write-Log "Adapter context before reset:"
(Get-NetIPConfiguration | Out-String).TrimEnd() | ForEach-Object { Write-Log $_ }
Write-Log ("Reset log requested from netsh: {0}" -f (Join-Path $env:TEMP 'resetlog.txt'))
$results = [ordered]@{}
$results.Winsock = Invoke-NetworkCommand 'netsh.exe' @('winsock','reset')
$results.TcpIp = Invoke-NetworkCommand 'netsh.exe' @('int','ip','reset',(Join-Path $env:TEMP 'resetlog.txt'))
$results.Release = Invoke-NetworkCommand 'ipconfig.exe' @('/release')
$results.Renew = Invoke-NetworkCommand 'ipconfig.exe' @('/renew')
if ($FlushDns) {
$results.FlushDns = Invoke-NetworkCommand 'ipconfig.exe' @('/flushdns')
} else {
Write-Log 'DNS flush not requested; use -FlushDns when DNS cache state is part of the symptom.'
}
Write-Log 'Adapter context after reset:'
(Get-NetIPConfiguration | Out-String).TrimEnd() | ForEach-Object { Write-Log $_ }
$defaultGateway = Get-NetIPConfiguration |
Where-Object { $_.IPv4DefaultGateway } |
Select-Object -First 1 -ExpandProperty IPv4DefaultGateway
if ($defaultGateway) {
$gatewayAddress = $defaultGateway.NextHop
Write-Log ("Testing default gateway: {0}" -f $gatewayAddress)
$gatewayResult = Test-Connection -TargetName $gatewayAddress -Count 2 -Quiet
Write-Log ("Gateway reachable: {0}" -f $gatewayResult)
} else {
Write-Log 'No IPv4 default gateway was found; gateway test was skipped.'
}
Write-Log 'The TCP/IP reset may require a restart. Review the log and restart Windows when ready.'
$results
The ampersand and redirection operators in the HTML code block are escaped as & and >&; when copying from a rendered page, ensure PowerShell receives the normal operators & and 2>&1, not literal HTML entities.
Run it with or without DNS flushing
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.Reset-LocalNetworkStack.ps1
.Reset-LocalNetworkStack.ps1 -FlushDns
The execution-policy command changes only the current PowerShell process. The first invocation runs the core sequence; the second adds the DNS-cache operation. The script writes a timestamped run log under the current user’s temporary directory and asks netsh to write its TCP/IP reset log to %TEMP%resetlog.txt.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
What should I expect from each command?
1. Winsock reset
netsh winsock reset resets the Winsock catalog to a clean state and removes custom layered service providers. This is aimed at corrupted Winsock settings that prevent applications from opening network connections. It does not renew an IP address or clear DNS records.
2. TCP/IP reset
netsh int ip reset "$env:TEMPresetlog.txt" rewrites TCP/IP-related settings and records the actions in the specified log. Microsoft documents this operation as equivalent in effect to removing and reinstalling TCP/IP. Treat the reset log as evidence: it can show which operations were attempted even when the final connectivity test fails.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware match3. DHCP release and renewal
ipconfig /release discards the current DHCP lease, and ipconfig /renew requests a new one. These commands are primarily useful on DHCP-managed adapters. A static IPv4 interface has no lease to renew, so a script must report the command result rather than declaring that addressing was repaired.
4. Optional DNS flush
ipconfig /flushdns removes the local resolver cache. Use it when a hostname is stale or resolves incorrectly, especially if direct connectivity to a known address works. It does not repair an unreachable DNS server, a bad DNS setting, or a broken upstream domain.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Do I have to restart Windows?
Plan to restart after the script completes. Microsoft’s documented TCP/IP reset workflow includes restarting the computer, and the TCP/IP reset command can report that a restart is required. Do not interpret a successful command exit code as proof that every change is active before rebooting.
After restarting, run Get-NetIPConfiguration again and compare the adapter, IPv4 address, gateway, and DNS servers with the values you recorded. If a static configuration is missing, restore it using the organization’s approved network settings rather than guessing addresses.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
How do I verify that the reset worked?
Verification must test the layers separately. A populated adapter configuration proves that Windows has address information; it does not prove that an application can reach its service.
- Run
Get-NetIPConfiguration. Confirm that the intended adapter has an IPv4 address and, for routed traffic, an IPv4 default gateway. - Check the reset log and the script log. Review every command’s output and exit code; investigate any nonzero result instead of treating the run as successful.
- Test the local path with
Test-Connectionto the reported default gateway. A failed gateway test points toward the adapter, local link, VLAN, or gateway path rather than a DNS-only problem. - Test name resolution separately with
Resolve-DnsNamefor a hostname used by the affected application. A successful gateway test plus failed name resolution narrows the issue to DNS configuration, server availability, or policy. - Retest the affected application after the restart. The script should report observations, not claim success merely because the commands ran.
What if the reset does not fix the connection?
Do not repeatedly run the same reset without collecting new evidence. Use the failure pattern to choose the next layer.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
The adapter has no address after renewal
Confirm that the adapter is enabled and intended to use DHCP. Check the physical or wireless link, switch or access-point association, and whether another device on the same network receives a lease. For a static interface, review the saved address, gateway, and DNS values instead of expecting /renew to help.
The gateway is unreachable
Focus on the adapter driver, link state, local firewall or security software, VLAN placement, and the gateway itself. Update or reinstall the adapter driver through the organization’s normal change process. A TCP/IP reset cannot repair a failed radio, cable, switch port, or access point.
Free tools Windows power users keep installed
One-click scans. No signup required.
The gateway works but names fail
Inspect the DNS servers shown by Get-NetIPConfiguration, then use Resolve-DnsName to distinguish resolver failure from an application-specific problem. Flush the cache only when stale local data is plausible; changing DNS servers or firewall policy is a separate administrative decision.
Only one application or destination times out
Check that application’s proxy, certificate, service endpoint, and local policy. If failures persist after configuration and driver checks, capture packets while reproducing the timeout. Packet capture can show whether the host sends traffic, receives a response, retransmits, or is rejected upstream; it is more informative than repeating resets.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
The reset command itself fails
Confirm that the console is elevated and review the exact output and exit code in the log. Look at the generated TCP/IP reset log for the operation that failed, then restart before judging the result. If the failure remains, escalate with the adapter model, driver version, network configuration, command output, and reset logs.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Which reset option should I choose?
| Option | Scope | Use when | Main trade-off |
|---|---|---|---|
| Minimal | Winsock catalog only | Applications fail while addressing and DNS appear normal | Leaves TCP/IP configuration, DHCP state, and DNS cache unchanged |
| Full documented sequence | Winsock, TCP/IP configuration, DHCP lease, and optionally DNS cache | Several network layers show symptoms or the stack appears corrupted | Connectivity drops, a restart may be required, and static settings need review |
| Escalation | Driver, link, policy, service, or packet path | Reset output is clean but the gateway, application, or destination still fails | Requires targeted diagnostics such as driver checks and packet capture rather than another reset |
How can I make the automation safer in managed environments?
- Require elevation and stop before changes when it is absent.
- Use an explicit
-FlushDnsswitch so DNS cache changes are visible in a ticket or deployment record. - Log the computer name, timestamp, adapter context, command text, output, and exit code.
- Warn users that DHCP release interrupts connectivity and that static interfaces may not respond meaningfully to release and renew.
- Do not schedule an automatic reboot unless your maintenance policy allows it; let the operator review the logs first.
- Keep the reset log with the incident record so a later driver or packet investigation has a precise timeline.
Frequently Asked Questions
Can I run the reset script through PowerShell remoting?
You can invoke PowerShell remotely only if remoting is already configured and the session has administrative rights, but the release and reset steps can interrupt that same connection. Use a local console or out-of-band management path when possible, and do not rely on the script to reconnect a lost remote session.
Will resetting Winsock remove VPN or security software?
The Winsock reset removes custom layered service-provider entries from the catalog; it does not uninstall a program. A VPN, filter, or security product that depends on such a provider may need its own repair or reinstallation after the reset.
Where should I send the logs when asking for help?
Provide the timestamped script log, the TCP/IP reset log, the adapter name and driver version, and the post-restart output from Get-NetIPConfiguration. Include the exact symptom and whether the gateway, DNS lookup, or only one application failed.
Does flushing DNS change the DNS server configured on my computer?
No. ipconfig /flushdns deletes cached name-to-address entries held locally. The configured DNS server addresses remain unchanged, so a bad server, blocked DNS traffic, or an authoritative DNS problem requires a different fix.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

