The guest operations agent is out of date, stopping script from continuing through loop

This post was originally published on this site

advanced apology/warning!:

I have tried to format my post to show the script nicely/properly using guide I was previously pointed to by a member on here but it just won’t (not sure if it’s because it’s quite long!) so my apologies ( I had this trouble before so I’ve attached my script instead)

 

my script is basically looping through every server on my estate, and determining a bunch of things and then getting the uptime of that server via the os guest (wasn’t happy with the stat from the hosts itself) . it works fine until it finds a server where invoke-vmscript returns the error “the guest operations agent is out of date”

 

fine don’t mind that i’ll just pipe that in my csv, move on and look at it after.. problem is – it stops my script dead, instead of continuing on through the estate (of which I suspect there to be more or the same error)

 

I thought by checking the tool status (which can seen in the ELSE of the first IF)  before going down to the level of the actual OS checking it would filter/capture it but it seems to be ignoring this. How would I go about doing this with invoke-vmscript? do I simply need to do another if and do something based on the scripts output.

 

any guidance is appreciated

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.