Edit

Share via


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

Default (Default)

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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InputObject

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

Parameter properties

Type:PSObject
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:VM

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-VMId

Specifies the virtual machine identifier (ID).

Parameter properties

Type:Guid
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

Microsoft.FailoverClusters.PowerShell.Cluster

Outputs

Microsoft.FailoverClusters.PowerShell.ClusterGroup