PowerCLI Reference

New-VMGuestRoute

Synopsis

This cmdlet adds a new route to the routing table of the provided virtual machines and guests.

Syntax

New-VMGuestRoute [-VM <VirtualMachine[]>] [-Destination] <IPAddress> [[-Netmask] <String>] [-Gateway] <IPAddress> [-Interface <Object>] [-VMGuest <VMGuest[]>] [-Server <VIServer[]>] [-ToolsWaitSecs <Int32>] [-GuestPassword <SecureString>] [-GuestUser <String>] [-GuestCredential <PSCredential>] [-HostPassword <SecureString>] [-HostUser <String>] [-HostCredential <PSCredential>] [-WhatIf] [-Confirm] [<CommonParameters>]

Related Commands

Online version
Get-VMGuestRoute
Remove-VMGuestRoute

Detailed Description

This cmdlet is deprecated. Use Invoke-VMGuestScript instead.

This cmdlet adds a new route to the routing table of the provided virtual machines and guests. The cmdlet adds only persistent routes. For a list of supported operating systems, see the PowerCLI User's Guide.

To run this cmdlet against vCenter Server/ESX/ESXi versions earlier than 5.0, you need to meet the following requirements:
*You must run the cmdlet on the 32-bit version of Windows PowerShell.
*You must have access to the ESX that hosts the virtual machine over TCP port 902.
*For vCenter Server/ESX/ESXi versions earlier than 4.1, you need VirtualMachine.Interact.ConsoleInteract privilege. For vCenter Server/ESX/ESXi 4.1 and later, you need VirtualMachine.Interact.GuestControl privilege.

To run this cmdlet against vCenter Server/ESXi 5.0 and later, you need VirtualMachine.GuestOperations.Execute and VirtualMachine.GuestOperations.Modify privileges.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
DestinationIPAddressSpecifies a destination IP address for the new route.truefalse
NetmaskStringSpecifies a network mask for the new route.falsefalse
GatewayIPAddressSpecifies a gateway for the new route.truefalse
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
GuestCredentialPSCredentialSpecifies a PSCredential object that contains credentials for authenticating with the guest OS. Do not use this parameter if the GuestUser and GuestPassword parameters are used.falsefalse
GuestPasswordSecureStringSpecifies the password you want to use for authenticating with the guest OS.falsefalse
GuestUserStringSpecifies the user name you want to use for authenticating with the guest OS.falsefalse
HostCredentialPSCredentialSpecifies a PSCredential object that contains credentials for authenticating with the host. Do not use this parameter if the HostUser and HostPassword parameters are used. You need to specify host credentials only if the version of the vCenter Server or ESX you are authenticating with is earlier than 4.0, or the VIX version you have installed is earlier than 1.10.falsefalse
HostPasswordSecureStringSpecifies the password you want to use for authenticating with the host. You need to specify host credentials only if the version of the vCenter Server or ESX you are authenticating with is earlier than 4.0, or the VIX version you have installed is earlier than 1.10.falsefalse
HostUserStringSpecifies the user name you want to use for authenticating with the host. You need to specify host credentials only if the version of the vCenter Server or ESX you are authenticating with is earlier than 4.0, or the VIX version you have installed is earlier than 1.10.falsefalse
InterfaceObjectSpecifies a network interface for the new route. For Linux guest operating systems, this parameter is mandatory.falsefalse
ServerVIServer[]Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.falsefalse
ToolsWaitSecsInt32Specifies the time in seconds to wait for a response from VMware Tools. If a non-positive value is provided, the system waits infinitely long time.falsefalse
VMVirtualMachine[]Specifies the virtual machines to which you want to add the new route.falsetrue (ByValue)
VMGuestVMGuest[]Specifies the guests to which you want to add the new route.falsetrue (ByValue)
WhatIfSwitchParameterIndicates that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falsefalse

Return Type

The newly created VMGuestRoute object

Notes

Consider that New-VMGuestRoute might behave inconsistently and create different types of routes depending on the OS type - Windows or Linux. This cmdlet is not compatible with IPv6 environments.

Examples

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

New-VMGuestRoute -GuestUser user -GuestPassword pass2 -VM $vm -Destination '192.168.100.10' -Netmask '255.255.255.255' -Gateway '10.23.112.58'

Creates a new guest route with the specified parameters.


Copyright © VMware, Inc. All rights reserved.