Greetings,
How can I check to see if the Powershell Connection to my servers is still up? I'm writing a script that uses VCB to back up a list of virtual machines, and it is working great, however a problem I am running into is that after some VM's that take a LONG time to back up, when it is ready to process the next host, the VI connection has timed out.
Easy fix to this was to just do a connect-viserver before each backup, but that is a lot of unnecessary overhead and I'd rather just check if the connection is up and then reconnect it only if it isn't available.
I know this is possible because the toolkit itself does it if you try to do a command and the connection isn't up. What object do I have to expose through the SDK to track this?
Thanks,
-Justin Grote
That subject has already been discussed in this community.
See .
If the time delay, as mentioned in that discussion, is no problem you could use something like that script.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Ah, thanks, I guess I should GTFA (Google the Freakin' Answer) next time.
I was hoping for a cleaner solution, like using the object returned from get-vc into get-view to access some kind of managed object who's connection I could track. Feature request?
Anyhow, in the meantime I just decided that for the purposes of this script, I'll just gather all the objects I need up-front so that a second connection doesn't have to be made.
Thanks!
