PowerCLI Reference



This cmdlet modifies a route in the host routing table.


Set-VMHostRoute [-VMHostRoute] <VMHostRoute[]> [-Destination <IPAddress>] [-Gateway <IPAddress>] [-PrefixLength <Int32>] [-Confirm] [-WhatIf] [<CommonParameters>]

Related Commands

Online Version

Detailed Description

This cmdlet modifies a route in the host routing table.


NameTypeDescriptionRequired?Pipeline InputDefault Value
VMHostRouteVMHostRoute[]Specifies the route you want to modify.trueTrue (ByValue)
ConfirmSwitchParameterIf the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false, the cmdlet runs without asking for user confirmation.falseFalse
DestinationIPAddressChanges the destination IP address of the route.falseFalse
GatewayIPAddressChanges the gateway IP address of the route.falseFalse
PrefixLengthInt32Modifies the prefix length of the destination IP address. For IPv4, the valid values are from 0 to 32, and for IPv6 - from 0 to 128.falseFalse
WhatIfSwitchParameterIndicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falseFalse

Return Type

Zero or more modified VMHostRoute objects


Supported only on ESX 4.1/ vCenter Server 4.1 and later.


-------------------------- Example 1 --------------------------

$vmhostroute = New-VMHostRoute -VMHost -Destination -Gateway -PrefixLength 32

$vmhostroute | Set-VMHostRoute -Gateway

Creates a new host route and modifies its gateway.

-------------------------- Example 2 --------------------------

$vmhostroute1 = New-VMHostRoute -VMHost -Destination -Gateway -PrefixLength 32

$vmhostroute2 = New-VMHostRoute -VMHost -Destination -Gateway -PrefixLength 32

Set-VMHostRoute -VMHostRoute ($vmhostroute1, $vmhostroute2) -Destination -PrefixLength 24

Modifies the destination and the prefix length of two host routes.

Copyright © VMware, Inc. All rights reserved.