vSphere PowerCLI Reference

Set-VMGuestNetworkInterface

Synopsis

Configures the network settings of a virtual machine using VMware Tools.

Syntax

Set-VMGuestNetworkInterface -VmGuestNetworkInterface <VMGuestNetworkInterface[]> [-WinsPolicy <DhcpPolicy>] [-Wins <String[]>] [-DnsPolicy <DhcpPolicy>] [-Dns <String[]>] [-IPPolicy <DhcpPolicy>] [[-Gateway] <Object>] [[-Netmask] <String>] [[-Ip] <IPAddress>] [-ToolsWaitSecs <Int32>] [-GuestPassword <SecureString>] [-GuestUser <String>] [-GuestCredential <PSCredential>] [-HostPassword <SecureString>] [-HostUser <String>] [-HostCredential <PSCredential>] [-WhatIf] [-Confirm] [<CommonParameters>]

Related Commands

Online version
Get-VMGuestNetworkInterface

Detailed Description

Configures the network settings of a virtual machine using VMware Tools. The cmdlet allows IP and routing configuration. You can modify Wins settings only for Windows virtual machines. The cmdlet sends a remote script which executes inside the virtual machine in the context of the specified user account. This cmdlet supports only Windows XP, Windows Server 2003, and Linux RedHat Enterprise 5. You can enhance this cmdlet to support other guest operating systems by modifying or adding custom scripts. The custom scripts are located in the "Scripts" folder in the PowerCLI installation directory and their names have the following format:

<CmdletName>_<OS_Identifier>

<OSIdentifier> is the guest family or the guest ID as returned by Get-VMGuest.
<CmdletName> is the name of the cmdlet without a hyphen, for example SetVMGuestNetworkInterface.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
IpIPAddressSpecify an IP address. Use this parameter only if The IpPolicy parameter is set to Static.falsefalse
NetmaskStringSpecify a net mask.falsefalse
GatewayObjectSpecify a gateway.falsefalse
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$true
DnsString[]Specify DNS addresses. Use this parameter only if The DnsPolicy parameter is set to Static.falsefalse
DnsPolicyDhcpPolicySpecify the DNS policy. The valid values are Static and Dhcp.falsefalse
GuestCredentialPSCredentialSpecify 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
GuestPasswordSecureStringSpecify the password you want to use for authenticating with the guest OS.falsefalse
GuestUserStringSpecify the user name you want to use for authenticating with the guest OS.falsefalse
HostCredentialPSCredentialSpecify 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
HostPasswordSecureStringSpecify 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
HostUserStringSpecify 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
IPPolicyDhcpPolicySpecify the IP policy. The valid values are Static and Dhcp.falsefalse
ToolsWaitSecsInt32Specify the time in seconds to wait for a response from the VMware Tools. If a non-positive value is provided, the system waits infinitely long time.falsefalse
VmGuestNetworkInterfaceVMGuestNetworkInterface[]Specify the guest network interface you want to configure.truetrue (ByValue)
WhatIfSwitchParameterIndicate that the cmdlet is run only to display the changes that would be made and actually no objects are modified.falsefalse
WinsString[]Specify WINS servers. Use this parameter only if The WinsPolicy parameter is set to Static.falsefalse
WinsPolicyDhcpPolicySpecify the Wins policy. The valid values are Static and Dhcp.falsefalse

Return Type

VMGuestNetwork

Notes

Supported on ESX 3.5 Update 2 and newer. This cmdlet works only in 32-bit mode. This cmdlet is experimental and might be changed or removed in a future rel ease.

Examples

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

Set-VMGuestNetworkInterface -VMGuestNetworkInterface $vmGuestNetworkInterface -HostUser Admin -HostPassword Pass01 -GuestUser User -GuestPassword Pass02 -Netmask 255.255.255.255 -Gateway 10.23.112.58

Changes the net mask and the gateway of the specified guest network interface,


Copyright © 1998 - 2011 VMware, Inc. All rights reserved.