Repair-SCVirtualMachine
Applies To: System Center 2012 - Virtual Machine Manager
Repair-SCVirtualMachine
Repairs a virtual machine in a failed state.
Syntax
Parameter Set: Agent
Repair-SCVirtualMachine [-VM] <VM> -Agent [-Credential <VMMCredential> ] [-JobVariable <String> ] [-PROTipID <Guid> ] [-RunAsynchronously] [ <CommonParameters>]
Parameter Set: Dismiss
Repair-SCVirtualMachine [-VM] <VM> -Dismiss [-Force] [-JobVariable <String> ] [-PROTipID <Guid> ] [-RunAsynchronously] [ <CommonParameters>]
Parameter Set: Retry
Repair-SCVirtualMachine [-VM] <VM> -Retry [-JobVariable <String> ] [-PROTipID <Guid> ] [-RunAsynchronously] [ <CommonParameters>]
Parameter Set: Undo
Repair-SCVirtualMachine [-VM] <VM> -Undo [-JobVariable <String> ] [-PROTipID <Guid> ] [-RunAsynchronously] [ <CommonParameters>]
Parameter Set: VMMSystemAccount
Repair-SCVirtualMachine [-VM] <VM> -Credential <VMMCredential> -VMMSystemAccount [-JobVariable <String> ] [-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 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
-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 |
-Credential<VMMCredential>
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".
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 |
-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 |
-VMMSystemAccount
Indicates that the VMM system account should be repaired or created, as applicable.
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.
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
- 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.
PS C:\> $VM = Get-SCVirtualMachine -Name "VM01"
PS C:\> Repair-SCVirtualMachine -VM $VM -Retry
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).
PS C:\> $VM = Get-SCVirtualMachine -Name "ServiceVM01"
PS C:\> $Creds = Get-Credential
PS C:\> Repair-SCVirtualMachine -VM $VM -Credential $Creds -Agent