VMware Cloud Community
agregrio
Contributor
Contributor

The server did not respond with an encrypted session key within the specified time-out period

I have a script that clones any number of VMs in my master lab to different demo labs. I am using powershell workflows to run the cloning operation in parallel. Once the clone is complete; I try to make sure that the VM has booted before proceeding with my post-clone steps and very frequently I get this error: "The server did not respond with an encrypted session key within the specified time-out period". When this happens; none of my post-clone steps run and someone has to manually perform them.

I've tried two different ways to detect if the server has booted but still seeing the error.

1.

"$(Get-Date -f 'yyyy-MM-dd HH:mm:ss') Starting VM $($myVM.DestVMName)";

$thisVM = Start-VM $myVM.DestVMName -Confirm:$False;

"$(Get-Date -f 'yyyy-MM-dd HH:mm:ss') Checking if $($myVM.DestVMName) has finished booting";

While($thisVM.ExtensionData.Guest.ToolsRunningStatus -ne "guestToolsRunning"){

Sleep 5;

$thisVM = Get-VM $myVM.DestVMName -EA SilentlyContinue;

}

2.

$thisVM = Get-VM $myVM.DestVMName -EA SilentlyContinue | Wait-Tools -HostCredential $AdminAccntLogin -TimeoutSeconds 500;

I also tried this as well:

Set-PowerCLIConfiguration -Scope AllUsers -WebOperationTimeoutSeconds 500 -Confirm:$False | Out-Null;

Any idea how to get around this issue?

0 Kudos
1 Reply
LucD
Leadership
Leadership

Are the VMware Tools installed on those VMs?

In that case, you could wait until the VMware Tools are fully operational.

Most of the time these tools are one of the last services/daemons to start.

$vm = Get-VM -Name MyVM

while(-not $vm.ExtensionData.Guest.GuestOperationsReady){

    sleep 5

    $vm = Get-VM -Name $vmName

}


Another option, when the VMware Tools are installed, is to use the Invoke-VMScript cmdlet.

That allows you to query inside the Guest OS if the services/daemons you require are running.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference