If you already know about the netsh winsock reset command but still wonder what it actually does, this post will help you understand it.
Winsock (Windows Sockets) is an API that defines how network applications in Windows can access network services, such as TCP/IP. Basically, Windows stores information related to Winsock in a database known as the Winsock Catalog. When this catalog becomes corrupt, you will start seeing weird network or internet connectivity problems. The following registry key holds the information about the Winsock catalog:
When you run the netsh winsock reset command, the existing Protocol_Catalog9 registry key is saved to Protocol_Catalog_Before_Reset and a new registry key is created with default parameters. The full path to the backup key is:
Remember that the aforementioned registry keys hold the Winsock parameters in binary format, which is difficult to understand. Later in this guide, I will show you a way to export the Winsock Catalog parameters to a text file that you can easily read and understand.
Why a Winsock reset is required
Before actually resetting the Winsock Catalog, let's first understand why you would need to do it. The Winsock Catalog could become corrupt for various reasons, such as:
Malware or adware infection—Cleaning up malware from a PC can corrupt the Winsock Catalog.
Incorrect network device installation or removal—When you install (or remove) a network device or VPN software incorrectly, it could lead to a corrupt Winsock Catalog.
Registry cleaning or optimization utility—Sometimes, a registry cleaner or optimization tool can mess up the registry, which in turn could cause the Winsock Catalog to become corrupt.
There may be other reasons in addition to these. No matter how the Winsock Catalog becomes corrupt, you need to reset it to fix the issue.
How to reset the Winsock Catalog
Now that you understand the Winsock Catalog and its importance in Windows, let's discuss how to reset it. To reset the Winsock:
Launch an elevated command prompt or PowerShell console (run cmd or PowerShell as administrator).
[Optional] If you want to view the Winsock parameters, use the following command (as discussed earlier, the Winsock parameters are stored in the registry in binary format, which is hard to read and understand):
netsh winsock show catalog
This command displays all the parameters, and the command output can be overwhelming. So, you might want to store the output in a file using netsh winsock show catalog > d:\winsock-before.txt command, as shown in the following screenshot:
This command stores the output in a text file that you can read and even compare later on after the Winsock reset.
Now, use the following command to reset the Winsock catalog:
netsh winsock reset
You need to restart your computer to complete the reset process.
To restart the computer, use the following PowerShell command:
When the PC reboots, your network problem should go away. If you still experience the problem, launch the elevated command prompt (or PowerShell) again, and follow the remaining steps.
If the problem persists, you might need to perform a TCP/IP reset on your PC. Note that this will completely remove the custom TCP/IP configurations from your network adapters. So, if you're using a manually configured IP address, gateway, and DNS settings, you might want to run the following command:
netsh int ip show config > d:\net_config.txt
This command saves all the IP configurations to a text file that you can refer to later on to manually configure the network adapters after reset.
Now use the following command to reset the TCP/IP protocol stack on your PC:
netsh int ip reset
This command overwrites the following two registry keys:
These registry keys are used by the TCP/IP protocol stack; running the netsh int ip reset command is essentially equivalent to removing and reinstalling the TCP/IP stack. By the way, you could save the output of the reset command to a file using the netsh int ip reset > d:\ip_reset_log.txt command.
Once this command is finished, you need to restart the computer and then reconfigure the TCP/IP settings for your network adapters. The backup of configuration settings comes in handy here if you don't remember them. If you use a DHCP server, your PC will automatically obtain the dynamic IP configuration. If it still doesn't pull the settings, use the ipconfig /renew command.
I hope this guide helps you fix the network or internet connectivity problems that are caused by a corrupt Winsock Catalog or a broken TCP/IP protocol stack.