plugins/providers/hyperv/scripts/clone_vhd.ps1 in vagrant-unbundled-2.1.1.0 vs plugins/providers/hyperv/scripts/clone_vhd.ps1 in vagrant-unbundled-2.1.2.0
- old
+ new
@@ -1,9 +1,18 @@
-Param(
+#Requires -Modules VagrantMessages
+
+param(
[Parameter(Mandatory=$true)]
[string]$Source,
[Parameter(Mandatory=$true)]
[string]$Destination
)
-Hyper-V\New-VHD -Path $Destination -ParentPath $Source -ErrorAction Stop
+$ErrorActionPreference = "Stop"
+
+try {
+ Hyper-V\New-VHD -Path $Destination -ParentPath $Source
+} catch {
+ Write-ErrorMessage "Failed to clone drive: ${PSItem}"
+ exit 1
+}