Finding vms with vmware tools that need to be upgraded. vmware tools status and version


Right, this is not some rocket science here but still i thought some people may be looking for that.

get-cluster your_cluster |Get-VM|?{$_.Extensiondata.Summary.Guest.ToolsVersionStatus -like 'guestToolsNeedUpgrade'} | select name,@{N='tools vers';E={$_.ExtensionData.Config.Tools.ToolsVersion}},@{N='Tools Status';E={$_.Extensiondata.Summary.Guest.ToolsVersionStatus}}

So i wanted to take cluster ‘your_cluster’ and get all vms in this cluster that have tools status of ‘guestToolsNeedUpgrade’. Well basically that’s pretty much it but i noticed that on large inventory it takes quite time to receive this list. So what might be interesting for people who have bigger vInfrastructure 😉
This query takes
Seconds : 41
So i spend few more minutes to get the same list but using get-view. It took:
Seconds : 1
Milliseconds : 174

😉
And the line:

get-view -ViewType virtualmachine -SearchRoot (get-cluster your_cluster).id -Filter @{'Summary.Guest.ToolsVersionStatus'='guestToolsNeedUpgrade'} | Select Name,@{N='tools ver';E={$_.Config.Tools.ToolsVersion}},@{N='Tools Status';E={$_.Summary.Guest.ToolsVersionStatus}}

So difference is 40 seconds 😉 Output is formatted like this
Name tools ver Tools Status
—- ———- ————
myvm1 8300 guestToolsNeedUpgrade
myvm2 8300 guestToolsNeedUpgrade
…… ….. ……………..

Advertisements

2 thoughts on “Finding vms with vmware tools that need to be upgraded. vmware tools status and version

  1. I bet the major profit is in using the string-compare (@{‘Summary.Guest.ToolsVersionStatus’=’guestToolsNeedUpgrade’}) in stead of the like-compare (?{$_.Extensiondata.Summary.Guest.ToolsVersionStatus -like ‘guestToolsNeedUpgrade’}).

    What if you change the ‘like’ compare in the first line with the stirng compare (use “=” or “-eq”)? I bet that makes it somehow faster too.

    • Hi there. That was not the point. Point was how to use the filter, which does server filtrr rather than downloading all the data and filter it on the client. Whatever you would do there you wouls ask server to send you all the data on which you are doing compare. It does not makw any sense to download all the data. Using views and filtera we are taking only that what we are interested in.
      Greg

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s