Set-VMNetworkAdapterFailoverConfiguration

Set-VMNetworkAdapterFailoverConfiguration

Configures the IP address of a virtual network adapter to be used when a virtual machine fails over.

语法

Parameter Set: VMName
Set-VMNetworkAdapterFailoverConfiguration [-VMName] <String> [-CimSession <Microsoft.Management.Infrastructure.CimSession[]> ] [-ClearFailoverIPv4Settings] [-ClearFailoverIPv6Settings] [-ComputerName <String[]> ] [-Credential <System.Management.Automation.PSCredential[]> ] [-IPv4Address <String> ] [-IPv4AlternateDNSServer <String> ] [-IPv4DefaultGateway <String> ] [-IPv4PreferredDNSServer <String> ] [-IPv4SubnetMask <String> ] [-IPv6Address <String> ] [-IPv6AlternateDNSServer <String> ] [-IPv6DefaultGateway <String> ] [-IPv6PreferredDNSServer <String> ] [-IPv6SubnetPrefixLength <Int32]> ] [-Passthru] [-VMNetworkAdapterName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ResourceObject
Set-VMNetworkAdapterFailoverConfiguration [-VMNetworkAdapter] <VMNetworkAdapter> [-ClearFailoverIPv4Settings] [-ClearFailoverIPv6Settings] [-IPv4Address <String> ] [-IPv4AlternateDNSServer <String> ] [-IPv4DefaultGateway <String> ] [-IPv4PreferredDNSServer <String> ] [-IPv4SubnetMask <String> ] [-IPv6Address <String> ] [-IPv6AlternateDNSServer <String> ] [-IPv6DefaultGateway <String> ] [-IPv6PreferredDNSServer <String> ] [-IPv6SubnetPrefixLength <Int32]> ] [-Passthru] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: VMObject
Set-VMNetworkAdapterFailoverConfiguration [-VM] <VirtualMachine> [-ClearFailoverIPv4Settings] [-ClearFailoverIPv6Settings] [-IPv4Address <String> ] [-IPv4AlternateDNSServer <String> ] [-IPv4DefaultGateway <String> ] [-IPv4PreferredDNSServer <String> ] [-IPv4SubnetMask <String> ] [-IPv6Address <String> ] [-IPv6AlternateDNSServer <String> ] [-IPv6DefaultGateway <String> ] [-IPv6PreferredDNSServer <String> ] [-IPv6SubnetPrefixLength <Int32]> ] [-Passthru] [-VMNetworkAdapterName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

详细说明

The Set-VMNetworkAdapterFailoverConfiguration cmdlet sets the configuration of an IP address of a virtual network adapter to be used when a virtual machine fails over.

参数

-CimSession<Microsoft.Management.Infrastructure.CimSession[]>

在远程会话中或远程计算机上运行该 cmdlet。输入计算机名或会话对象,如 New-cimsessionGet-cimsession cmdlet 的输出。默认为本地计算机上的当前会话。

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-ClearFailoverIPv4Settings

Clears the configured IPv4 failover settings. The IPv4 address configured in the primary virtual machine (static or dynamic) will be used by the Replica virtual machine.

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-ClearFailoverIPv6Settings

Clears the configured IPv6 failover settings. The IPv6 address configured in the primary virtual machine (static or dynamic) will be used by the Replica virtual machine.

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-ComputerName<String[]>

Specifies one or more Hyper-V hosts on which the IP address configuration of a virtual network adapter is to be set. NetBIOS names, IP addresses, and fully qualified domain names are allowable. The default is the local computer. Use localhost or a dot (.) to specify the local computer explicitly.

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-Credential<System.Management.Automation.PSCredential[]>

Specifies one or more user accounts that have permission to perform this action. The default is the current user.

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-Passthru

Specifies that a Microsoft.HyperV.PowerShell.VMNetworkAdapterFailoverConfiguration object is to be passed through to the pipeline representing the IP address configuration to be set.

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-VM<VirtualMachine>

Specifies the virtual machine for which you want to configure the IP address.

别名

none

是否必需?

true

在哪里?

1

默认值

none

是否接受管道输入?

True (ByValue)

是否接受通配符?

false

-VMName<String>

Specifies the friendly name of the virtual machine for which you want to configure the IP address.

别名

none

是否必需?

true

在哪里?

1

默认值

none

是否接受管道输入?

True (ByValue)

是否接受通配符?

false

-VMNetworkAdapter<VMNetworkAdapter>

Specifies the virtual network adapter for which you want to configure the IP address.

别名

none

是否必需?

true

在哪里?

1

默认值

none

是否接受管道输入?

True (ByValue, ByPropertyName)

是否接受通配符?

false

-IPv4Address<String>

Specifies the IPv4 address to set on the VMNetworkAdapter for use on failover of the virtual machine. You must also specify the IPv4SubnetMask parameter when you specify this parameter.

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-IPv4AlternateDNSServer<String>

Specifies the IPv4 alternate DNS server to be set on the VMNetworkAdapter for use on failover of the virtual machine.

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-IPv4DefaultGateway<String>

Specifies the IPv4 default gateway to be set on VMNetworkAdapter for use on failover of the virtual machine..

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-IPv4PreferredDNSServer<String>

Specifies the IPv4 preferred DNS server to be set on VMNetworkAdapter for use on failover of the virtual machine.

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-IPv4SubnetMask<String>

Specifies the IPv4 subnet mask to be set on VMNetworkAdapter for use on failover of the virtual machine. You must specify the IPv4Address parameter when you specify this parameter.

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-IPv6Address<String>

Specifies the IPv6 address to be set on VMNetworkAdapter for use on failover of the virtual machine. You must specify the IPv6SubnetPrefixLength parameter when you specify this parameter.

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-IPv6AlternateDNSServer<String>

Specifies the IPv6 alternate DNS server to be set on VMNetworkAdapter for use on failover of the virtual machine.

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-IPv6DefaultGateway<String>

Specifies the IPv6 default gateway to be set on VMNetworkAdapter for use on failover of the virtual machine.

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-IPv6PreferredDNSServer<String>

Specifies the IPv6 preferred DNS server to be set on VMNetworkAdapter for use on failover of the virtual machine.

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-IPv6SubnetPrefixLength<Int32]>

Specifies the IPv6 subnet prefix length to be set on VMNetworkAdapter for use on failover of the virtual machine. You must specify the IPv6Address parameter when you specify this parameter.

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-VMNetworkAdapterName<String>

Specifies the name of the virtual network adapter for which you want to set the IP address.

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-Confirm

在运行 cmdlet 前提示你进行确认。

是否必需?

false

在哪里?

named

默认值

false

是否接受管道输入?

false

是否接受通配符?

false

-WhatIf

显示在 cmdlet 运行时将发生的情况。该 cmdlet 不运行。

是否必需?

false

在哪里?

named

默认值

false

是否接受管道输入?

false

是否接受通配符?

false

<CommonParameters>

此 cmdlet 支持常见的参数:-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer 和 -OutVariable。有关详细信息,请参阅 TechNet 上的 about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216)。

输入

输入类型是可以传送到 cmdlet 的对象的类型。

输出

输出类型是 cmdlet 发出的对象的类型。

  • None by default; Microsoft.HyperV.PowerShell.VMNetworkAdapterFailoverConfiguration if –PassThru is specified.

示例

Example 1

This example configures a failover IPv4 address for virtual network adapter NetworkAdapter01 on virtual machine VM01.

PS C:\> Get-VMNetworkAdapter VM01 NetworkAdapter01 | Set-VMNetworkAdapterFailoverConfiguration –IPv4Address 10.100.1.100 –IPv4SubnetMask 255.255.255.0

Example 2

This example clears the current failover IPv4 settings on virtual network adapter NetworkAdapter01 for virtual machine VM01.

PS C:\> Get-VMNetworkAdapter VM01 NetworkAdapter01 | Set-VMNetworkAdapterFailoverConfiguration –ClearFailoverIPv4Settings

Example 3

This example configures an IPv6 address and a prefix length of 12 for a virtual network adapter NetworkAdapter01 for virtual machine VM01.

PS C:\> Get-VMNetworkAdapter VM01 NetworkAdapter01 | Set-VMNetworkAdapterFailoverConfiguration –Ipv6Address aaaa:aaaa:aaaa:aaaa:aaaa:aaaa:aaa:aaaa –Ipv6SubnetPrefixLength 12

Example 4

This example clears the current failover IPv6 settings on a virtual network adapter NetworkAdapter01 for virtual machine VM01.

PS C:\> Get-VMNetworkAdapter VM01 NetworkAdapter01 | Set-VMNetworkAdapterFailoverConfiguration –ClearFailoverIPv6Settings