COMMAND EVERYTHING.
Removes IP routes from the IP routing table.
Microsoft NetTCPIP reference: Removes IP routes from the IP routing table. The syntax and selected example below are adapted from the pinned Windows Server 2025 reference. Module availability, target configuration and delegated permissions determine whether it can run in your environment. Documentation and parameter text: Microsoft, CC BY 4.0; formatting adapted by Cmdlet World. No execution testing is claimed.
Use an account with the target resource permissions documented for Remove-NetRoute. Modifying administrative cmdlets may require elevation or delegated administration. This catalog does not assert that ordinary users can execute the command.
Windows / NetTCPIP · Windows Server 2025 documentation; feature/module prerequisites apply
-AddressFamily- Specifies an array of IP address families of IP routes. The cmdlet removes IP routes that belong to the families that you specify. The acceptable values for this parameter are: - IPv4 - IPv6
-AsJob- Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete.
-AssociatedIPInterface- Specifies an IP interface as a CIM object. The cmdlet removes IP routes that belong to the interfaces that you specify. To obtain an IP interface, use the Get-NetIPInterface cmdlet.
-CimSession- Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.
-CompartmentId- Specifies an array of identifiers for network compartments in the protocol stack. By default, the cmdlet only removes Net routes in the default compartment. If you specify a value, the cmdlet removes any matching Net routes in all compartments in this field.
-Confirm- Prompts you for confirmation before running the cmdlet.
-DestinationPrefix- Specifies an array of destination prefixes of IP routes. The cmdlet removes IP routes that use the prefixes that you specify. A destination prefix contains an IP address prefix and a prefix length, separated by a slash (/). A value of 0.0.0.0/0 for IPv4 or ::/0 for IPv6 indicates that the value of the NextHop parameter is a default gateway.
-IncludeAllCompartments- Indicates that the cmdlet includes routes from all configured network compartments. If you do not specify this parameter, the cmdlet removes only routes in the default network compartment.
-InputObject (required)- Specifies the input object that is used in a pipeline command.
-InterfaceAlias- Specifies an array of aliases of network interfaces. The cmdlet removes IP routes for the interfaces that have the aliases that you specify.
-InterfaceIndex- Specifies an array of indexes of network interfaces. The cmdlet removes IP routes for the interfaces located at the indexes that you specify.
-InterfaceMetric- Specifies an array of integer interface metrics for network interfaces. The cmdlet gets IP routes for the interfaces that have the metric that you specify.
-NextHop- Specifies an array of next hop values. The cmdlet removes routes that have the next hop values that you specify. A value of 0.0.0.0 for IPv4 or :: for IPv6 indicates that the route is on the local subnet.
-PassThru- Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.
-PolicyStore- Specifies a PolicyStore value. The cmdlet removes IP routes that have the PolicyStore value that you specify. The acceptable values for this parameter are: - ActiveStore. The IP address information is valid. - PersistentStore. The computer saves IP address information across restarts. When the computer restarts, it copies the saved settings to the ActiveStore.
-PreferredLifetime- Specifies an array of values for preferred lifetime, as TimeSpan objects, of IP routes. The cmdlet removes IP routes that have the lifetimes that you specify. To obtain a TimeSpan object, use the New-TimeSpan cmdlet. For more information, type Get-Help New-TimeSpan.
-Protocol- Specifies an array of types of routing protocols. The cmdlet removes IP routes that use the protocols that you specify. The acceptable values for this parameter are: - Bbn - Bgp - Dhcp - Dvmrp - Egp - Eigrp - EsIs - Ggp - Hello - Icmp - Idpr - Igrp - IsIs - Local - NetMgmt - Ospf - Rip - Rpl - Other
-Publish- Specifies an array of publish settings of IP routes. The cmdlet removes IP routes that have the publish settings that you specify. The acceptable values for this parameter are: - No. Do not publish or advertise IP route information in router advertisements. - Yes. Publish and advertise IP route information that includes an infinite valid lifetime in router advertisements - Age. Publish and advertise IP route information with a finite valid lifetime in router advertisements.
-RouteMetric- Specifies an array of integer route metrics for IP routes. The cmdlet removes IP routes that have the metrics that you specify. To choose among multiple routes, the computer adds this value to the interface metric value. The computer selects the route with the lowest combined value. To modify the interface metric, use the Set-NetIPInterface cmdlet.
-State- Specifies an array of state values for IP routes. The cmdlet gets entries that have the state values that you specify.
-ThrottleLimit- Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0 is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer.
-ValidLifetime- Specifies an array of values for valid lifetime, as a TimeSpan object, for IP routes. The cmdlet removes IP routes that have the lifetime that you specify. To obtain a TimeSpan object, use the New-TimeSpan cmdlet.
-WhatIf- Shows what would happen if the cmdlet runs. The cmdlet is not run.
Windows with the NetTCPIP module and the Windows feature or management tools that provide it. Confirm target connectivity and version compatibility using the linked Microsoft reference.
This cmdlet changes system state. Review every target and parameter in the official reference, test outside production, and prepare an appropriate backup or rollback. Do not execute the example automatically.