How can I modify this script to contain only the VMs that have VMware tools installed:
get-vm | where-object {$_ [checkfortools]}
Thanks!
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
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
Hey Luc,
I thought so too but when I tried it I got an error. Maybe it was just a typo
Thanks for stating this.
Tim