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 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

Easy peasy!

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