Udostępnij za pośrednictwem


Join-SCVirtualMachine

Re-associates an orphaned virtual machine to its service or virtual machine role.

Syntax

ServiceComputerTierParameterSet

Join-SCVirtualMachine
    [-VM] <VM>
    -ComputerTier <ComputerTier>
    [-RunAsynchronously]
    [-PROTipID <Guid>]
    [-JobVariable <String>]
    [-OnBehalfOfUser <String>]
    [-OnBehalfOfUserRole <UserRole>]
    [<CommonParameters>]

VMRoleParameterSet

Join-SCVirtualMachine
    [-VM] <VM>
    -VMRole <CloudVmRole>
    [-RunAsynchronously]
    [-PROTipID <Guid>]
    [-JobVariable <String>]
    [-OnBehalfOfUser <String>]
    [-OnBehalfOfUserRole <UserRole>]
    [<CommonParameters>]

Description

The Join-SCVirtualMachine cmdlet re-associates an orphaned virtual machine to its service or virtual machine role.

When a host or cluster is removed from Virtual Machine Manager (VMM), any virtual machines belonging to a service or a virtual machine role deployed on the host remain functional. However, on adding the host or cluster back to VMM, the virtual machines become orphaned in the sense that they no longer have any association with their service or virtual machine role.

You can use this cmdlet to restore the association between a virtual machine and its service or virtual machine role. The Join-SCVirtualMachine cmdlet runs a re-associate task on VMM that performs a set of validations that help confirm the compatibility of the virtual machine with the service template.

When the cmdlet validates the compatibility of the virtual machine with the computer tier template, database-only operations are performed, and no adjustments are made to the virtual machine. It is assumed that the virtual machine is running and that all of the guest applications and services running on it are intact.

The computer tier to which you want to join the virtual machine must be running below its maximum instance count. The upgrade domain for the join operation is similar to a scale-out.

For best results, use this cmdlet with a virtual machine that was originally part of a service or virtual machine role deployment and was not modified.

Examples

Example 1: Join an orphaned virtual machine to a service tier

PS C:\> $VM = Get-SCVirtualMachine -Name "PS-Web-001"
PS C:\> $CT = Get-SCComputerTier -Name "MyService-WebTier"
PS C:\> Join-SCVirtualMachine -VM $VM -ComputerTier $CT

The first command gets the virtual machine named PS-Web-001, and then stores it in the $VM variable.

The second command gets the computer tier named MyService-WebTier, and then stores it in the $CT variable.

The last command joins the virtual machine in $VM to the computer tier in $CT.

Example 2: Join an orphaned virtual machine to a virtual machine role

PS C:\> $VM = Get-SCVirtualMachine -Name "PS-Web-001"
PS C:\> $VmRole = Get-CloudResource -Name "ContosoShop"
PS C:\> Join-SCVirtualMachine -VM $VM -VMRole $VmRole

The first command gets the virtual machine named PS-Web-001, and then stores it in the $VM variable.

The second command gets the cloud resource named ContosoShop, and then stores it in the $VmRole variable.

The last command joins the virtual machine in $VM to the role in $VMRole.

Parameters

-ComputerTier

Specifies a ComputerTier object.

Parameter properties

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

Parameter sets

ServiceComputerTierParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-JobVariable

Specifies a variable in which job progress is tracked and stored.

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

-OnBehalfOfUser

Specifies a user name. This cmdlet operates on behalf of the user that this parameter specifies.

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

-OnBehalfOfUserRole

Specifies a user role. To obtain a user role, use the Get-SCUserRole cmdlet. This cmdlet operates on behalf of the user role that this parameter specifies.

Parameter properties

Type:UserRole
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

-PROTipID

Specifies the ID of the Performance and Resource Optimization tip (PRO tip) that triggered this action. This parameter lets you audit PRO tips.

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:False
Value from remaining arguments:False

-RunAsynchronously

Indicates that the job runs asynchronously so that control returns to the command shell immediately.

Parameter properties

Type:SwitchParameter
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

-VM

Specifies a VM object.

Parameter properties

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

Parameter sets

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

-VMRole

Specifies a CloudVMRole object.

Parameter properties

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

Parameter sets

VMRoleParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
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.