Param($Arg1) $targetvhd = $Arg1 if (($targetvhd -eq $null) -or !(Test-Path $targetvhd)) { Write-Host "Error: targetvhd missing" exit } dir $targetvhd Mount-VHD $targetvhd -NoDriveLetter -Readonly Optimize-VHD $targetvhd -Mode Quick Optimize-VHD $targetvhd -Mode Quick Dismount-VHD $targetvhd dir $targetvhd