Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
windows:hyper-v:windows-vm-template-deployment-customzation [2026/05/15 09:09] chriswindows:hyper-v:windows-vm-template-deployment-customzation [2026/05/19 15:02] (current) chris
Line 93: Line 93:
 # Wait VM provisioned # Wait VM provisioned
 $Seconds = 0 $Seconds = 0
 +$Stage = 0 
 Do { Do {
  $Seconds++  $Seconds++
  Start-Sleep -Seconds 1  Start-Sleep -Seconds 1
  $HeartBeat = Get-VMIntegrationService -VMName $VMName -Name "Heartbeat"  # https://learn.microsoft.com/en-us/powershell/module/hyper-v/get-vmintegrationservice?view=windowsserver2025-ps  $HeartBeat = Get-VMIntegrationService -VMName $VMName -Name "Heartbeat"  # https://learn.microsoft.com/en-us/powershell/module/hyper-v/get-vmintegrationservice?view=windowsserver2025-ps
- Write-Host -NoNewLine "`rWaiting for VM to provision ($Seconds)" + If ($Stage -in @(0, 2) -and $HeartBeat.PrimaryStatusDescription -eq 'OK') { 
-} Until (($HeartBeat.PrimaryStatusDescription -eq 'OK'))+ $Stage++ 
 +
 + If ($Stage -eq 1 -and $HeartBeat.PrimaryStatusDescription -ne 'OK') { 
 + $Stage++ 
 +
 + Write-Host -NoNewLine "`rWaiting for VM to provision ($Seconds)[$Stage]
 +} Until ($Stage -ge 3)