Contact

Subscribe via Email

Subscribe via RSS

Categories

Creative Commons Attribution 4.0 International License
© Rakhesh Sasidharan

Using Remove-NetRoute to mass remove routes

Was checking my Windows 8 machine routing table (route print) when I noticed many entries like this:

Not sure what they are. I didn’t create them, and the 192.168.1.1 address is not on my network.

To be on the safe side I wanted to remove them. One could do it via route delete but that’s so old fashioned and slow (I would have to do it for each entry). What I want is a quick and easy way of mass removing routes. Enter the routing table related cmdlets in PowerShell 3.0.

The following one-liner will remove all routes whose NextHop address is 192.168.1.1:

Easy peasy!

For PowerShell 2.0 am sure there would be a WMI way of achieving the same. Will post that later.

Using Remove-NetRoute to mass remove routes by rakhesh is licensed under a Creative Commons Attribution 4.0 International License.