Repair-VM

Repairs one or more virtual machines.

Syntax

Repair-VM
      [-CompatibilityReport] <VMCompatibilityReport>
      [-SnapshotFilePath <String>]
      [-Path <String>]
      [-Passthru]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Repair-VM cmdlet corrects some issues that can impact the ability to import or move a virtual machine. If Compare-VM determines that an import or move operation would fail for a particular VM, it returns a collection of incompatibilities that need to be fixed before the operation can succeed. Most of these incompatibilities can be fixed by using Set-VM. However, Set-VM does not modify either the path where the VM configuration is stored or the path where the snapshot files are stored. Repair-VM handles these two particular issues in this one specific situation.

Examples

Example 1

PS C:\> Repair-VM -CompatibilityReport $VMCompatReport -Path C:\Test

This example changes the configuration path for a virtual machine compatibility report.

Example 2

PS C:\> Repair-VM -CompatibilityReport $VMCompatReport -SnapshotFilePath C:\Snapshots

This example adds missing snapshots to a virtual machine compatibility report.

Parameters

-CompatibilityReport

Specifies a compatibility report which includes adjustments to be made during repair.

Type:VMCompatibilityReport
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Passthru

Specifies that an object is to be passed through to the pipeline representing the newly modified compatibility report.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Path

Specifies the path of the virtual machine to be repaired.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SnapshotFilePath

Specifies the path to be search for virtual machine snapshots.

Type:String
Aliases:CheckpointFileLocation, SnapshotFileLocation
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

None

Default

Microsoft.HyperV.PowerShell.CompatibilityReport

If -PassThru is specified.