VMware Cloud Community
TheVMinator
Expert
Expert

Checking for VMware tools

How can I modify this script to contain only the VMs that have VMware tools installed:

get-vm | where-object {$_ [checkfortools]}

Thanks!

0 Kudos
3 Replies
schepp
Leadership
Leadership

Hi,

you can check different things as "installed" does not mean it's always good. The tools can be installed but can be old.

Here's an example of the different tool states you can check:

ToolsStatus         : toolsOld

ToolsVersionStatus  : guestToolsNeedUpgrade

ToolsVersionStatus2 : guestToolsTooOld

ToolsRunningStatus  : guestToolsRunning

And here's a snippet example on how to check it:

get-vm | Where-Object { (get-vm -Name $_.name).Extensiondata.Summary.Guest.ToolsStatus -eq "toolsOk" }

So you can build your own check that meets your requirements ( tools running/ old / need update / etc.)

Regards

0 Kudos
LucD
Leadership
Leadership

Great explanation and script, but I think you can make it a bit faster by dropping 1 Get-VM

Get-VM | Where-Object { $_.Extensiondata.Summary.Guest.ToolsStatus -eq "toolsOk" }


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
schepp
Leadership
Leadership

Hey Luc,

I thought so too but when I tried it I got an error. Maybe it was just a typo Smiley Happy

Thanks for stating this.

Tim

0 Kudos