I’m running into an issue with my script to deploy and setup a new VM in AHV. The part to check for and install Windows Patches can take a while and sometimes I come out of that routine and I’m no longer connected to Prism Element.
I connect with Connect-NTNXCluster…
I’ve seen where you can use $TestConnect = Get-NutanixCluster and then check the .IsConnected parameter.
However in my testing, I last connected yesterday and when I run that this morning it still shows .IsConnected = True so it doesn’t seem like it gets updated.
I’ve also changed the Prism Element GUI settings to a 2 hour timeout but still seems like after way less than that I am no longer connected. Does that apply to script connections as well?
What is a good/reliable way to test if I'm still connected (outside of trying a command and catching the “unauthorized” error)?