We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 64146ae commit 5e23286Copy full SHA for 5e23286
1 file changed
ComputeAdmin/AzureStack.ComputeAdmin.psm1
@@ -481,8 +481,12 @@ function New-Server2016VMImage {
481
} catch {
482
Write-Error -ErrorRecord $_ -ErrorAction Stop
483
} finally {
484
- if (Test-Path -Path "$VHDDriveLetter`:\") {
485
- $VHDPath | Dismount-DiskImage
+ $retryAttempts = 0;
+ while ((Test-Path -Path "$VHDDriveLetter`:\") -and ($retryAttempts -lt 5)) {
486
+ Write-Verbose -Message "Attempting to dismount the VHD..."
487
+ Get-DiskImage -ImagePath $VHDPath | Dismount-DiskImage
488
+ $retryAttempts = $retryAttempts+1;
489
+ sleep 1
490
}
491
if ($IsoMount) {
492
$IsoMount | Dismount-DiskImage
0 commit comments