Start-VMFailover

Start-VMFailover

Starts failover on a virtual machine.

语法

Parameter Set: VMName
Start-VMFailover [-VMName] <String[]> [-AsJob] [-CimSession <Microsoft.Management.Infrastructure.CimSession[]> ] [-ComputerName <String[]> ] [-Credential <System.Management.Automation.PSCredential[]> ] [-Passthru] [-Prepare] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: VMName_Test
Start-VMFailover [-VMName] <String[]> -AsTest [-AsJob] [-CimSession <Microsoft.Management.Infrastructure.CimSession[]> ] [-ComputerName <String[]> ] [-Credential <System.Management.Automation.PSCredential[]> ] [-Passthru] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: VMObject
Start-VMFailover [-VM] <VirtualMachine[]> [-AsJob] [-Passthru] [-Prepare] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: VMObject_Test
Start-VMFailover [-VM] <VirtualMachine[]> -AsTest [-AsJob] [-Passthru] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: VMSnapshot
Start-VMFailover [-VMRecoverySnapshot] <VMSnapshot> [-AsJob] [-Passthru] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: VMSnapshot_Test
Start-VMFailover [-VMRecoverySnapshot] <VMSnapshot> -AsTest [-AsJob] [-Passthru] [-Confirm] [-WhatIf] [ <CommonParameters>]

详细说明

The Start-VMFailover cmdlet can be used for the following tasks:

   -- Fail over a Replica virtual machine to a chosen recovery point.

   -- Start a planned failover on a primary virtual machine.

   -- Create a test virtual machine on a Replica virtual machine.

参数

-AsJob

Runs the cmdlet as a background job.

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-AsTest

Creates a test virtual machine using the chosen recovery point. You can use a test virtual machine to validate a Replica virtual machine. To stop a test failover, use the Stop-VMFailover cmdlet.

别名

none

是否必需?

true

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

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

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

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-ComputerName<String[]>

Specifies one or more Hyper-V hosts on which failover is to be started. 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 virtual machine object is to be passed through to the pipeline representing the virtual machine on which failover is to be started.

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-Prepare

Starts the planned failover on the primary virtual machine and replicates any pending changes. To complete the planned failover, use the Set-VMReplication and Start-VM cmdlets as shown in Example 4.

Note: The primary virtual machine must be shut down to prepare it for failover.

别名

none

是否必需?

false

在哪里?

named

默认值

none

是否接受管道输入?

false

是否接受通配符?

false

-VM<VirtualMachine[]>

Specifies the virtual machine for which failover is to be started.

别名

none

是否必需?

true

在哪里?

1

默认值

none

是否接受管道输入?

True (ByValue)

是否接受通配符?

false

-VMName<String[]>

Specifies the name of the virtual machine for which failover is to be started.

别名

none

是否必需?

true

在哪里?

1

默认值

none

是否接受管道输入?

True (ByValue)

是否接受通配符?

false

-VMRecoverySnapshot<VMSnapshot>

Specifies the recovery snapshot to use during a failover. (This parameter is not required for a planned failover.)

别名

VMRecoveryCheckpoint

是否必需?

true

在哪里?

1

默认值

none

是否接受管道输入?

True (ByValue)

是否接受通配符?

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.VirtualMachine if –PassThru is specified.

示例

Example 1

This example starts failover of a virtual machine named VM01 with recovery point Snapshot01.

Note: Recovery points are stored as snapshots. To get a list of all snapshots, use the Get-VMSnapshot cmdlet.

PS C:\> Get-VMSnapshot VM01 –Name Snapshot01 | Start-VMFailover

Example 2

This example starts a test failover of a virtual machine named VM01.

PS C:\> Start-VMFailover VM01 -AsTest

Example 3

Starts a test failover of a virtual machine named VM01 with recovery point Snapshot01.

PS C:\> Get-VMSnapshot VM01 –Name Snapshot01 | Start-VMFailover -AsTest

Example 4

This example shows the cmdlets you use to perform a planned failover. The first command prepares for the planned failover of a primary virtual machine named VM01 by replicating any pending changes. The second command fails over the Replica virtual machine. The third command switches the Replica virtual machine to a primary virtual machine. The fourth command starts the virtual machine that has been switched from a Replica virtual machine to a primary virtual machine.

PS C:\> Start-VMFailover –Prepare –VMName VM01  -computername MyPrimary.contoso.com
PS C:\> Start-VMFailover –VMName VM01 –computername MyReplica.contoso.com
PS C:\> Set-VMReplication –Reverse –VMName VM01 –computername MyReplica.contoso.com
PS C:\> Start-VM –VMName VM01 –computername MyReplica.contoso.com