Move-ClusterVirtualMachineRole

Move-ClusterVirtualMachineRole

Move the ownership of a clustered virtual machine to a different node.

Syntax

Move-ClusterVirtualMachineRole [-InputObject <psobject>] [[-Name] <string>] [[-Node] <string>] [-Cancel] [-Cluster <string>] [-Wait <int>] [<CommonParameters>]
  • InputObject

  • Name

  • Node

  • Cancel

  • Cluster

  • Wait

Detailed Description

This cmdlet is used to live migrate a clustered virtual machine. For quick migration, use Move-ClusterGroup after using Get-ClusterResource and Set-ClusterParameter to set the OfflineAction parameter of the virtual machine resource to save state (value 1).

Parameters

Cancel

Causes an in-progress live migration of the virtual machine specified to be canceled.

Default Value: **

Data Type: SwitchParameter

Attributes

Name Value PSMAML Attribute

Required?

false

required

Variable Length?

false

variableLength

Accept wildcard characters?

false

globbing

Accept Pipeline Input?

false

pipelineInput

Position?

named

position

Value Attributes

Name Value PSMAML Attribute

Required?

false

required

Variable Length?

false

variableLength

Cluster

Specifies the name of the cluster to run this cmdlet on. If you type "-Cluster ." or omit the parameter, the cmdlet runs on the local cluster.

Default Value: **

Data Type: string

Attributes

Name Value PSMAML Attribute

Required?

false

required

Variable Length?

false

variableLength

Accept wildcard characters?

false

globbing

Accept Pipeline Input?

false

pipelineInput

Position?

named

position

Value Attributes

Name Value PSMAML Attribute

Required?

true

required

Variable Length?

false

variableLength

InputObject

Specifies the cluster virtual machine resource group to move.

Default Value: **

Data Type: psobject

Attributes

Name Value PSMAML Attribute

Required?

false

required

Variable Length?

false

variableLength

Accept wildcard characters?

false

globbing

Accept Pipeline Input?

true (ByValue)

pipelineInput

Position?

named

position

Value Attributes

Name Value PSMAML Attribute

Required?

true

required

Variable Length?

false

variableLength

Name

Specifies the name of the cluster virtual machine to move.

Default Value: **

Data Type: string

Attributes

Name Value PSMAML Attribute

Required?

false

required

Variable Length?

false

variableLength

Accept wildcard characters?

false

globbing

Accept Pipeline Input?

false

pipelineInput

Position?

1

position

Value Attributes

Name Value PSMAML Attribute

Required?

true

required

Variable Length?

false

variableLength

Node

Specifies the name of the cluster node to move the virtual machine to.

Default Value: **

Data Type: string

Attributes

Name Value PSMAML Attribute

Required?

false

required

Variable Length?

false

variableLength

Accept wildcard characters?

false

globbing

Accept Pipeline Input?

false

pipelineInput

Position?

2

position

Value Attributes

Name Value PSMAML Attribute

Required?

true

required

Variable Length?

false

variableLength

Wait

Specifies the time in seconds to wait for the operation. If this parameter is not specified the operation waits for completion. If "-Wait 0" is specified the call is initiated and the cmdlet returns right away.

Default Value: **

Data Type: int

Attributes

Name Value PSMAML Attribute

Required?

false

required

Variable Length?

false

variableLength

Accept wildcard characters?

false

globbing

Accept Pipeline Input?

false

pipelineInput

Position?

named

position

Value Attributes

Name Value PSMAML Attribute

Required?

true

required

Variable Length?

false

variableLength

Input Type

Microsoft.FailoverClusters.PowerShell.ClusterGroup

Return Type

Microsoft.FailoverClusters.PowerShell.ClusterGroup

Examples

-------------------------- EXAMPLE 1 --------------------------

Command Prompt: C:\PS>

 
Move-ClusterVirtualMachineRole "Virtual Machine1" -Node node2 
 
Name                       OwnerNode                           State 
----                       ---------                           ----- 
Virtual Machine1           node2                              Online

Description

-----------

This command performs a live migration of Virtual Machine1 to node2. The prompt does not return until the action is complete.

 

-------------------------- EXAMPLE 2 --------------------------

Command Prompt: C:\PS>

 
Get-ClusterGroup "Virtual Machine1" | Move-ClusterVirtualMachineRole -Node node2 -Wait 0 
 
Name                       OwnerNode                           State 
----                       ---------                           ----- 
Virtual Machine1           node2                              Online

Description

-----------

This command performs a live migration of Virtual Machine1 to node2. The prompt returns as soon as the action has been initiated.

 

-------------------------- EXAMPLE 3 --------------------------

Command Prompt: C:\PS>

 
Move-ClusterVirtualMachineRole "Virtual Machine1" -Cancel 
 
Name                       OwnerNode                           State 
----                       ---------                           ----- 
Virtual Machine1           node1                              Online

Description

-----------

This command cancels the live migration in progress for Virtual Machine1.

 

-------------------------- EXAMPLE 4 --------------------------

Command Prompt: C:\PS>

 
$groups = Get-ClusterNode node1 | Get-ClusterGroup | ?{ $_ | Get-ClusterResource | ?{ $_.ResourceType -like "Virtual Machine" } } 
foreach ( $group in $groups ) { $group | Move-ClusterVirtualMachineRole -Node node2 } 
 
Name                       OwnerNode                           State 
----                       ---------                           ----- 
Virtual Machine1           node2                              Online 
Virtual Machine2           node2                              Online 
Virtual Machine3           node2                              Online

Description

-----------

This command performs a live migration of all clustered virtual machines that are currently owned by node1 to node2. The migration of each VM should complete before the next one is started. You can use this command before performing maintenance on the specified node.

See Also

Reference

Update-ClusterVirtualMachineConfiguration
Add-ClusterVirtualMachineRole

Other Resources

Online version: