From 1b4ffe546f8980e9aa86144a896133355ee04f3c Mon Sep 17 00:00:00 2001 From: Marcin Bojko Date: Sat, 19 Oct 2019 12:46:34 +0200 Subject: [PATCH] hyper-v fix for compacting vhdx/vhd only --- common/powershell/hyperv/hyperv.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/powershell/hyperv/hyperv.go b/common/powershell/hyperv/hyperv.go index e93a885eb..132c5d216 100644 --- a/common/powershell/hyperv/hyperv.go +++ b/common/powershell/hyperv/hyperv.go @@ -860,7 +860,7 @@ func CompactDisks(path string) (result string, err error) { var script = ` param([string]$srcPath) -$disks = Get-ChildItem -Path $srcPath -Recurse -Filter *.vhd* -ErrorAction SilentlyContinue | % { $_.FullName } +$disks = Get-ChildItem -Path $srcPath -Recurse -ErrorAction SilentlyContinue |where {$_.extension -in ".vhdx",".vhd"} |foreach { $_.FullName } # Failure to find any disks is treated as a 'soft' error. Simply print out # a warning and exit if ($disks.Length -eq 0) {