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?