Daniel's Tech Blog

Cloud Computing, Cloud Native & Kubernetes

SCVMM / SMA runbook is stucked in an infinity loop

Just a quick note to a situation I experienced last week I want to share with you.

Assume you have installed the VMM console on your SMA runbook worker to get the VMM PowerShell cmdlets. So you can leverage them directly on the runbook worker.

The important part is to keep the VMM console up to date on the runbook worker and at the same version compared to your VMM management server. Otherwise you will experience the same as I have done it.

If there is a version mismatch between the VMM management server and the VMM console on the runbook server, then your runbooks can get into an infinity loop.

$Result = InlineScript {
    Get-SCVMMServer -ComputerName $USING:VMMServer -Credential $USING:Credential
    While ((Get-SCJob -ID $USING:VMMJobId).Status -eq 'Running') {
        $Progress = (Get-SCJob -ID $USING:VMMJobId).ProgressValue
        Start-Sleep -Seconds 3
    }
    $Result = (Get-SCJob -ID $USING:VMMJobId).Status
    Return $Result
}

The snippet above is typically for a runbook that is called by a cloud automation action in Windows Azure Pack, where the runbook will connect to the VMM management server and waits for the VMM job to be completed before taking further actions on a VM.

Exactly the first part Get-SCVMMServer will put your runbook into the infinity loop. The reason for that is the version mismatch between the VMM management server and the VMM console on the runbook server. In this situation the VMM console or the VMM PowerShell cmdlet tries to connect to VMM, but will be immmediately disconnected. At this point it is a loop of connect and disconnect. The only way to solve this is to update the VMM console on your SMA runbook worker.

WordPress Cookie Notice by Real Cookie Banner