The Repair-SCVirtualMachine cmdlet repairs a virtual machine in a failed state that is on a host managed by System Center 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 option 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 option 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.
For more information about Repair-SCVirtualMachine, type: "Get-Help Repair-SCVirtualMachine -online".
Parameters
VM
Required?
true
Accept Pipeline Input?
true (ByValue)
Position?
0
Specifies a virtual machine object.
Agent
Required?
true
Accept Pipeline Input?
false
Position?
named
Indicates that the VMM in-guest agent should be repaired or upgraded, as applicable.
Credential
Required?
false
Accept Pipeline Input?
false
Position?
named
Specifies a credential object or, for some cmdlets, a Run As account object that contains the user name and password of an account that has permission to perform this action. Or, in the case of Restart-SCJob, has permission to complete a restarted task.
For more information about the PSCredential object, type: "Get-Help Get-Credential".
For more information about Run As accounts, type: "Get-Help New-SCRunAsAccount".
JobVariable
Required?
false
Accept Pipeline Input?
false
Position?
named
Specifies that job progress is tracked and stored in the variable named by this parameter.
PROTipID
Required?
false
Accept Pipeline Input?
false
Position?
named
Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.
RunAsynchronously
Required?
false
Accept Pipeline Input?
false
Position?
named
Indicates that the job runs asynchronously so that control returns to the command shell immediately.
VM
Required?
true
Accept Pipeline Input?
true (ByValue)
Position?
0
Specifies a virtual machine object.
Dismiss
Required?
true
Accept Pipeline Input?
false
Position?
named
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.
Force
Required?
false
Accept Pipeline Input?
false
Position?
named
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.
JobVariable
Required?
false
Accept Pipeline Input?
false
Position?
named
Specifies that job progress is tracked and stored in the variable named by this parameter.
PROTipID
Required?
false
Accept Pipeline Input?
false
Position?
named
Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.
RunAsynchronously
Required?
false
Accept Pipeline Input?
false
Position?
named
Indicates that the job runs asynchronously so that control returns to the command shell immediately.
VM
Required?
true
Accept Pipeline Input?
true (ByValue)
Position?
0
Specifies a virtual machine object.
Retry
Required?
true
Accept Pipeline Input?
false
Position?
named
Retries the last task that failed on a VMM object in an attempt to complete the task successfully.
JobVariable
Required?
false
Accept Pipeline Input?
false
Position?
named
Specifies that job progress is tracked and stored in the variable named by this parameter.
PROTipID
Required?
false
Accept Pipeline Input?
false
Position?
named
Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.
RunAsynchronously
Required?
false
Accept Pipeline Input?
false
Position?
named
Indicates that the job runs asynchronously so that control returns to the command shell immediately.
VM
Required?
true
Accept Pipeline Input?
true (ByValue)
Position?
0
Specifies a virtual machine object.
Undo
Required?
true
Accept Pipeline Input?
false
Position?
named
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.
JobVariable
Required?
false
Accept Pipeline Input?
false
Position?
named
Specifies that job progress is tracked and stored in the variable named by this parameter.
PROTipID
Required?
false
Accept Pipeline Input?
false
Position?
named
Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.
RunAsynchronously
Required?
false
Accept Pipeline Input?
false
Position?
named
Indicates that the job runs asynchronously so that control returns to the command shell immediately.
VM
Required?
true
Accept Pipeline Input?
true (ByValue)
Position?
0
Specifies a virtual machine object.
VMMSystemAccount
Required?
true
Accept Pipeline Input?
false
Position?
named
Indicates that the VMM system account should be repaired or created, as applicable.
Credential
Required?
false
Accept Pipeline Input?
false
Position?
named
Specifies a credential object or, for some cmdlets, a Run As account object that contains the user name and password of an account that has permission to perform this action. Or, in the case of Restart-SCJob, has permission to complete a restarted task.
For more information about the PSCredential object, type: "Get-Help Get-Credential".
For more information about Run As accounts, type: "Get-Help New-SCRunAsAccount".
JobVariable
Required?
false
Accept Pipeline Input?
false
Position?
named
Specifies that job progress is tracked and stored in the variable named by this parameter.
PROTipID
Required?
false
Accept Pipeline Input?
false
Position?
named
Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.
RunAsynchronously
Required?
false
Accept Pipeline Input?
false
Position?
named
Indicates that the job runs asynchronously so that control returns to the command shell immediately.
Requires a virtual machine object, which can be retrieved by using the Get-SCVirtual Machine cmdlet.
Examples
1: Repair a failed migration task by
retrying the migration task.
The first command gets the virtual machine object named VM01 and 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 (migrate) the virtual machine from one host to another.
The second command repairs the virtual machine object stored in $VM (in this case, VM01) by restarting the previous failed migration task.
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 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 stores the object in the $Creds variable
The third command repairs the in-guest agent on the virtual machine object stored in $VM (ServiceVM01).