Can you share the error/warning message as it appears on screen?
Also, that is a rather strange try-catch construct.
As far as I understand it, it check if the VM can be found (with the Get-VM), if that fails it enters the catch block.
Be aware that the variable $vmToolsGuestOperationReady is local to the try-block, unless you defined it in a higher scope somewhere else in your script.