Remove-NetRoute

Remove-NetRoute

Removes IP routes from the IP routing table.

Syntax

Parameter Set: ByName
Remove-NetRoute [[-DestinationPrefix] <String[]> ] [-AddressFamily <AddressFamily[]> ] [-AssociatedIPInterface <CimInstance> ] [-CimSession <CimSession[]> ] [-CompartmentId <UInt32[]> ] [-IncludeAllCompartments] [-InterfaceAlias <String[]> ] [-InterfaceIndex <UInt32[]> ] [-NextHop <String[]> ] [-PassThru] [-PolicyStore <String> ] [-PreferredLifetime <TimeSpan[]> ] [-Protocol <Protocol[]> ] [-Publish <Publish[]> ] [-RouteMetric <UInt16[]> ] [-ThrottleLimit <Int32> ] [-ValidLifetime <TimeSpan[]> ] [-Confirm] [-WhatIf] [ <CommonParameters>] [ <WorkflowParameters>]

Parameter Set: InputObject (cdxml)
Remove-NetRoute [-CimSession <CimSession[]> ] [-PassThru] [-ThrottleLimit <Int32> ] [-Confirm] [-WhatIf] [ <CommonParameters>] [ <WorkflowParameters>]

Detaillierte Beschreibung

The Remove-NetRoute cmdlet removes IP routes from the IP routing table. Run this cmdlet without any parameters to remove all IP routes from the routing table, including default routes. You can also specify routes to remove by specifying parameters, or by using the Get-NetRoute cmdlet.

For more information about routing, see Chapter 5 - IP Routing (https://technet.microsoft.com/library/bb727001.aspx) in the TechNet library.

Parameter

-AddressFamily<AddressFamily[]>

Specifies an array of IP address families of IP routes. The cmdlet removes IP routes that belong to the families that you specify. Die zulässigen Werte für diesen Parameter sind:

-- IPv4
-- IPv6

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-AssociatedIPInterface<CimInstance>

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.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

True (ByValue)

Platzhalterzeichen akzeptieren?

false

-CimSession<CimSession[]>

Das Cmdlet wird in einer Remotesitzung oder auf einem Remotecomputer ausgeführt. Geben Sie einen Computernamen oder ein Sitzungsobjekt ein, wie z. B. die Ausgabe eines New-CimSession oder Get-CimSession-Cmdlets. Der Standardwert ist die aktuelle Sitzung auf dem lokalen Computer.

Aliase

Session

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-CompartmentId<UInt32[]>

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.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-DestinationPrefix<String[]>

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.

Aliase

none

Erforderlich?

false

Position?

1

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

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

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-InterfaceAlias<String[]>

Specifies an array of aliases of network interfaces. The cmdlet removes IP routes for the interfaces that have the aliases that you specify.

Aliase

ifAlias

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-InterfaceIndex<UInt32[]>

Specifies an array of indexes of network interfaces. The cmdlet removes IP routes for the interfaces located at the indexes that you specify.

Aliase

ifIndex

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-NextHop<String[]>

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.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-PassThru

Gibt ein Objekt an, das das Element darstellt, mit dem Sie arbeiten. Dieses Cmdlet generiert standardmäßig keine Ausgabe.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-PolicyStore<String>

Specifies a PolicyStore value. The cmdlet removes IP routes that have the PolicyStore value that you specify. Die zulässigen Werte für diesen Parameter sind:

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

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-PreferredLifetime<TimeSpan[]>

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.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-Protocol<Protocol[]>

Specifies an array of types of routing protocols. The cmdlet removes IP routes that use the protocols that you specify. Die zulässigen Werte für diesen Parameter sind:

-- Bbn
-- Bgp
-- Dhcp
-- Dvmrp
-- Egp
-- Eigrp
-- EsIs
-- Ggp
-- Hello
-- Icmp
-- Idpr
-- Igrp
-- IsIs
-- Local
-- NetMgmt
-- Ospf
-- Rip
-- Rpl
-- Other

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-Publish<Publish[]>

Specifies an array of publish settings of IP routes. The cmdlet removes IP routes that have the publish settings that you specify. Die zulässigen Werte für diesen Parameter sind:

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

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-RouteMetric<UInt16[]>

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.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-ThrottleLimit<Int32>

Gibt die maximale Anzahl gleichzeitiger Vorgänge an, die zum Ausführen des Cmdlets hergestellt werden können. Wenn dieser Parameter ausgelassen wird oder der Wert 0 eingegeben wird, berechnet Windows PowerShell ® einen optimalen Drosselungsgrenzwert für das Cmdlet basierend auf der Anzahl der CIM-Cmdlets, die auf dem Computer ausgeführt werden. Der Grenzwert gilt nur für das aktuelle Cmdlet, nicht für die Sitzung oder den Computer.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-ValidLifetime<TimeSpan[]>

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.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-Confirm

Fordert Sie vor der Ausführung des Cmdlet zum Bestätigen auf.

Erforderlich?

false

Position?

named

Standardwert

false

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

-WhatIf

Zeit, was passieren würde, wenn das Cmdlet ausgeführt wird. Das Cmdlet wird nicht ausgeführt.

Erforderlich?

false

Position?

named

Standardwert

false

Pipelineeingaben akzeptieren?

false

Platzhalterzeichen akzeptieren?

false

<CommonParameters>

Dieses Cmdlet unterstützt die allgemeinen Parameter: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer und -OutVariable. Weitere Informationen finden Sie unter about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

<WorkflowParameters>

Eingaben

Der Eingabetyp ist der Typ der Objekte, die Sie per Piping an das Cmdlet übergeben können.

  • Microsoft.Management.Infrastructure.CimInstance#rootStandardCimv2MSFT_NetRoute

    Das Microsoft.Management.Infrastructure.CimInstance-Objekt ist eine Wrapperklasse, die Windows-Verwaltungsinstrumentation-Objekte (Windows Management Instrumentation, WMI) angezeigt. Der Pfad nach dem Nummernzeichen (#) stellt den Namespace und den Klassennamen des zugrunde liegenden WMI-Objekts dar.

Ausgaben

Der Ausgabetyp ist der Typ der Objekte, die vom Cmdlet ausgegeben werden.

  • None

Beispiele

Example 1: Remove all routes

This command removes all of the IP routes on the computer, including default routes.

PS C:\> Remove-NetRoute

Example 2: Remove routes for a specified next hop

This command removes all of the IP routes that have a next hop of 192.168.0.1.

PS C:\> Remove-NetRoute –NextHop "192.168.0.1"

Verwandte Themen

Find-NetRoute

Get-NetRoute

New-NetRoute

Set-NetRoute

Get-NetIPInterface