PowerShell Logo Small

New-NetRoute



This is the built-in help made by Microsoft for the command 'New-NetRoute', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Creates a route in the IP routing table.

SYNTAX


New-NetRoute [-DestinationPrefix] <String> [-AddressFamily <AddressFamily>] [-AsJob] [-CimSession <CimSession[]>] [-NextHop <String>] [-PolicyStore <String>]
[-PreferredLifetime <TimeSpan>] [-Protocol <Protocol>] [-Publish <Publish>] [-RouteMetric <UInt16>] [-ThrottleLimit <Int32>] [-ValidLifetime <TimeSpan>] -InterfaceAlias
<String> [-Confirm] [-WhatIf] [<CommonParameters>]
New-NetRoute [-DestinationPrefix] <String> [-AddressFamily <AddressFamily>] [-AsJob] [-CimSession <CimSession[]>] [-NextHop <String>] [-PolicyStore <String>]
[-PreferredLifetime <TimeSpan>] [-Protocol <Protocol>] [-Publish <Publish>] [-RouteMetric <UInt16>] [-ThrottleLimit <Int32>] [-ValidLifetime <TimeSpan>] -InterfaceIndex
<UInt32> [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The New-NetRoute cmdlet creates an IP route in the IP routing table. Specify the destination prefix, and specify an interface by using the interface alias or the interface
index.


IP routing is the process of forwarding a packet based on the destination IP address. Routing occurs at TCP/IP hosts and at IP routers. The sending host or router determines
where to forward the packet. To determine where to forward a packet, the host or router consults a routing table that is stored in memory. When TCP/IP starts, it creates
entries in the routing table. You can add entries either manually or automatically.


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



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/?LinkID=288396
Find-NetRoute
Get-NetRoute
Remove-NetRoute
Set-NetRoute
Set-NetIPInterface

REMARKS

<

Examples


Example 1: Add an IP route to the routing table

PS C:\>New-NetRoute –DestinationPrefix "10.0.0.0/24" –InterfaceIndex 12 –NextHop 192.168.0.1PS C:\>Get-NetRoute | Format-List -Property *



This example adds a routing table entry, and then displays the properties of all the entries in the routing table.

The first command creates a route for the destination prefix 10.0.0.0/24 for the interface that has the index of 12. The command specifies 192.168.0.1 as the next hop.

The second command uses the Get-NetRoute cmdlet to get all the routes for the computer, and then passes them to the Format-List cmdlet by using the pipeline operator. The
Format-List cmdlet can display all the properties of an object. For more information, type Get-Help Format-List.