編輯

共用方式為


Add-ClusterVirtualMachineRole

Creates a clustered virtual machine, that is, a virtual machine that can be failed over if necessary to a different server in the failover cluster.

Syntax

Add-ClusterVirtualMachineRole
   [-Name <String>]
   [[-VMName] <String>]
   [-VirtualMachine <String>]
   [-VMId <Guid>]
   [-InputObject <PSObject>]
   [-Cluster <String>]
   [<CommonParameters>]

Description

The Add-ClusterVirtualMachineRole cmdlet creates a clustered virtual machine, that is, a virtual machine that can be failed over if necessary to a different server in the failover cluster.

By creating clustered virtual machines, you can consolidate multiple servers on one physical server without causing that server to become a single point of failure. Instead, if that server, or cluster node, fails or requires scheduled maintenance, then another node begins to run the virtual machines instead through a process known as failover. The virtual hard disk (VHD) file for the clustered virtual machine must be on the clustered disk used by that virtual machine.

Note

Examples

Example 1

Add-ClusterVirtualMachineRole -VirtualMachine VM1

This example configures VM1 as a clustered virtual machine, and assigns a default name.

Example 2

Add-ClusterVirtualMachineRole -VirtualMachine VM1 -Name "MainServer1"

This example configures VM1 as a clustered virtual machine, and assigns the name MainServer1.

Example 3

Get-VM -Name *print* | Add-ClusterVirtualMachineRole

This example queries for virtual machines matching the wildcard characters *print* and configures them as clustered virtual machines.

Parameters

-Cluster

Specifies the name of the cluster on which to run this cmdlet. If the input for this parameter is . or it is omitted, then the cmdlet runs on the local cluster.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

Specifies the cluster on which to create the highly available virtual machine.

Type:PSObject
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Name

Specifies the name of the highly available virtual machine to create.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VirtualMachine

Specifies the name of the virtual machine to make highly available. Use either the VirtualMachine parameter or the VMName parameter to specify the name of the virtual machine.

Type:String
Aliases:VM
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VMId

Specifies the virtual machine identifier (ID).

Type:Guid
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-VMName

Specifies the name of the virtual machine to make highly available. Use either the VirtualMachine parameter or the VMName parameter to specify the name of the virtual machine.

Type:String
Position:0
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

Inputs

Microsoft.FailoverClusters.PowerShell.Cluster

Outputs

Microsoft.FailoverClusters.PowerShell.ClusterGroup