Condividi tramite


Join-SCVirtualMachine

Join-SCVirtualMachine

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

Syntax

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

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

Detailed 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.

Parameters

-ComputerTier<ComputerTier>

Specifies the computer tier of a service instance to which to join a virtual machine.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-JobVariable<String>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-OnBehalfOfUser<String>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-OnBehalfOfUserRole<UserRole>

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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PROTipID<Guid]>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RunAsynchronously

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VM<VM>

Specifies the virtual machine to join.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true(ByValue)

Accept Wildcard Characters?

false

-VMRole<CloudVmRole>

Specifies a virtual machine role object to join.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Notes

  • Joining a virtual machine to a service or virtual machine role that uses load balancers is not supported. If you attempt to join a virtual machine to a service or virtual machine role that uses load balancers, then you must configure any load balancer settings manually.

Examples

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

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.

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

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

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 PetShop, and then stores it in the $VmRole variable.

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

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

Get-SCComputerTier

Get-SCVirtualMachine

Move-SCVirtualMachine

New-SCVirtualMachine

Read-SCVirtualMachine

Register-SCVirtualMachine

Remove-SCVirtualMachine

Repair-SCVirtualMachine

Reset-SCVirtualMachine

Resume-SCVirtualMachine

Save-SCVirtualMachine

Set-SCVirtualMachine

Start-SCVirtualMachine

Stop-SCVirtualMachine

Suspend-SCVirtualMachine