diff --git a/images.CI/macos/move-vm.ps1 b/images.CI/macos/move-vm.ps1 index 8e8c3b749..4128c36b7 100644 --- a/images.CI/macos/move-vm.ps1 +++ b/images.CI/macos/move-vm.ps1 @@ -71,6 +71,7 @@ if ($env:AGENT_JOBSTATUS -eq 'Failed') { Write-Host "VM has been successfully powered off and renamed to [${VMName}_failed]" } catch { Write-Host "##vso[task.LogIssue type=error;]Failed to power off and rename VM '$VMName'" + exit 1 } } @@ -79,6 +80,7 @@ try { Write-Host "VM has been moved successfully to target datastore '$TargetDataStore'" } catch { Write-Host "##vso[task.LogIssue type=error;]Failed to move VM '$VMName' to target datastore '$TargetDataStore'" + exit 1 } try { @@ -86,4 +88,5 @@ try { $vm | Set-VM -NumCPU $CpuCount -CoresPerSocket $CoresPerSocketCount -MemoryMB $Memory -Confirm:$false -ErrorAction Stop | Out-Null } catch { Write-Host "##vso[task.LogIssue type=error;]Failed to change specs for VM '$VMName'" + exit 1 }