Edit

Share via


Repair-VM

Repairs one or more virtual machines.

Syntax

Default (Default)

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.

Parameter properties

Type:VMCompatibilityReport
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Passthru

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Path

Specifies the path of the virtual machine to be repaired.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SnapshotFilePath

Specifies the path to be search for virtual machine snapshots.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:CheckpointFileLocation, SnapshotFileLocation

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

None

Default

Microsoft.HyperV.PowerShell.CompatibilityReport

If -PassThru is specified.