Condividi tramite


Repair-SCVirtualMachine

Repair-SCVirtualMachine

Repairs a virtual machine in a failed state.

Syntax

Parameter Set: Agent
Repair-SCVirtualMachine [-VM] <VM> -Agent [-JobVariable <String> ] [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [ <CommonParameters>]

Parameter Set: Dismiss
Repair-SCVirtualMachine [-VM] <VM> -Dismiss [-Force] [-JobVariable <String> ] [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [ <CommonParameters>]

Parameter Set: MigrateDBOnlyVM
Repair-SCVirtualMachine -MigrateDBOnlyVM -VMHost <Microsoft.SystemCenter.VirtualMachineManager.Host> [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [ <CommonParameters>]

Parameter Set: Retry
Repair-SCVirtualMachine [-VM] <VM> -Retry [-JobVariable <String> ] [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [ <CommonParameters>]

Parameter Set: Undo
Repair-SCVirtualMachine [-VM] <VM> -Undo [-JobVariable <String> ] [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [ <CommonParameters>]

Detailed Description

The Repair-SCVirtualMachine cmdlet repairs a virtual machine in a failed state that is on a host managed by Virtual Machine Manager (VMM). A virtual machine can be in one of four types of failed state:

-- Creation Failed
-- Migration Failed
-- Update Failed
-- Deletion Failed

You can use this command to repair a failure as follows:

-- Retry. Attempts to perform the failed job again.

-- Undo. Attempts to undo any changes made to the virtual machine and restore it to a healthy state. For example, if a Move-SCVirtualMachine job fails, using the Undo parameter attempts to move the virtual machine back to its previous host.

-- Dismiss. Dismisses the failed job and refreshes the virtual machine based on its current state. If you manually fix a failure (for example, by manually moving the .vhd and .vmc files to a new host after a failed Move-SCVirtialMachine attempt), you can use the Dismiss parameter to refresh the data for the virtual machine in the VMM database. However, using the Dismiss option might return the object to the failed state.

When you run Repair-SCVirtualMachine, you can specify only one type of action at a time.

You can run Repair-SCVirtualMachine to repair an in-guest agent for a virtual machine that is part of a service by using the Agent parameter.

Parameters

-Agent

Indicates that the VMM in-guest agent should be repaired or upgraded, as applicable.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Dismiss

Dismisses the error on an object or an update notification on a service instance.

After an error is dismissed, the object is refreshed. If the error reappears, refreshing does not solve the problem and you must fix the error.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Force

Forces the operation to complete.

For example:

- Remove-SCSCVMHost -Force

Forces the removal of a host object from the VMM database.

- Stop-SCVirtualMachine -Force

Stops a virtual machine.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-JobVariable<String>

Specifies that job progress is tracked and stored in the variable named by this parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-MigrateDBOnlyVM

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-OnBehalfOfUser<System.String>

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-OnBehalfOfUserRole<Microsoft.SystemCenter.VirtualMachineManager.UserRole>

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PROTipID<Guid]>

Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Retry

Retries the last task that failed on a VMM object in an attempt to complete the task successfully.

Aliases

none

Required?

true

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

-Undo

Cancels the last job run on a VMM object and reverses any changes that were made. This parameter is available only if the most recent job failed.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VM<VM>

Specifies a virtual machine object.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-VMHost<Microsoft.SystemCenter.VirtualMachineManager.Host>

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.

  • VirtualMachine

Notes

  • This cmdlet requires a virtual machine object, which can be retrieved by using the Get-SCVirtualMachine cmdlet.

Examples

Example 1: Repair a failed migration task by retrying the migration task

The first command gets the virtual machine object named VM01, and then stores the object in the $VM variable. This example assumes that the task that you want to repair by using the Retry parameter is an attempt to move the virtual machine from one host to another.

The second command repairs the virtual machine object stored in $VM by restarting the previous failed migration task.

PS C:\> $VM = Get-SCVirtualMachine -Name "VM01"
PS C:\> Repair-SCVirtualMachine -VM $VM -Retry

Example 2: Repair or upgrade the VMM In-guest agent on a specified virtual machine that is part of a service

The first command gets the virtual machine object named ServiceVM01, and then stores the object in the $VM variable. This example assumes that the virtual machine is part of a service.

The second command gets a credential object, which must be a local administrator on the virtual machine to be repaired, and then stores the object in the $Creds variable.

The third command repairs the in-guest agent on the virtual machine object stored in $VM.

PS C:\> $VM = Get-SCVirtualMachine -Name "ServiceVM01"
PS C:\> $Creds = Get-Credential
PS C:\> Repair-SCVirtualMachine -VM $VM -Credential $Creds -Agent

Get-SCVirtualMachine

Move-SCVirtualMachine

New-SCVirtualMachine

Read-SCVirtualMachine

Register-SCVirtualMachine

Remove-SCVirtualMachine

Reset-SCVirtualMachine

Resume-SCVirtualMachine

Set-SCVirtualMachine

Start-SCVirtualMachine

Stop-SCVirtualMachine

Suspend-SCVirtualMachine