Ignore errors when generating new VM configuration
The default error action is to stop. When generating the initial VM configuration during import, if the Compare-VM command fails it results in a generic error message. Instead the error should be ignored so the source VM can be inspected and a useful error message can be returned to the user.
This commit is contained in:
parent
b2e682b0e3
commit
83ed01869d
|
@ -85,7 +85,7 @@ function New-VagrantVMVMCX {
|
||||||
VhdDestinationPath = Join-Path $DataPath "Virtual Hard Disks";
|
VhdDestinationPath = Join-Path $DataPath "Virtual Hard Disks";
|
||||||
VirtualMachinePath = $DataPath;
|
VirtualMachinePath = $DataPath;
|
||||||
}
|
}
|
||||||
$VMConfig = (Hyper-V\Compare-VM -Copy -GenerateNewID @NewVMConfig)
|
$VMConfig = (Hyper-V\Compare-VM -Copy -GenerateNewID @NewVMConfig -ErrorAction SilentlyContinue)
|
||||||
|
|
||||||
# If the config is empty it means the import failed. Attempt to provide
|
# If the config is empty it means the import failed. Attempt to provide
|
||||||
# context for failure
|
# context for failure
|
||||||
|
|
Loading…
Reference in New Issue