Repair-VM

Repair-VM

Repairs one or more virtual machines.

語法

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

詳細描述

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.

參數

-CompatibilityReport<VMCompatibilityReport>

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

別名

none

必要項?

true

位置?

1

預設值

none

接受管線輸入?

True (ByValue)

接受萬用字元?

false

-Passthru

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

別名

none

必要項?

false

位置?

named

預設值

none

接受管線輸入?

false

接受萬用字元?

false

-Path<String>

Specifies the path of the virtual machine to be repaired.

別名

none

必要項?

false

位置?

named

預設值

none

接受管線輸入?

false

接受萬用字元?

false

-SnapshotFilePath<String>

Specifies the path to be search for virtual machine snapshots.

別名

CheckpointFileLocation,SnapshotFileLocation

必要項?

false

位置?

named

預設值

none

接受管線輸入?

false

接受萬用字元?

false

-Confirm

在執行指令程式之前提示您確認。

必要項?

false

位置?

named

預設值

false

接受管線輸入?

false

接受萬用字元?

false

-WhatIf

示範當執行指令程式時會發生什麼事情。此指令程式並未執行。

必要項?

false

位置?

named

預設值

false

接受管線輸入?

false

接受萬用字元?

false

<CommonParameters>

這個指令程式支援一般參數:-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer 和 -OutVariable。如需詳細資訊,請參閱 about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216)。

輸入

輸入類型是可透過管道傳送至指令程式的物件類型。

輸出

輸出類型是指令程式所發出的物件類型。

  • None by default; Microsoft.HyperV.PowerShell.CompatibilityReport if –PassThru is specified.

範例

Example 1

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

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

Example 2

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

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