Monday, November 23, 2015

PowerCLI script to show VM's needing VMware Tools upgraded.

I started looking for a way to inventory all of our VM's currently running within our 6-7 clusters.
Most of our VM's had the latest version of VMware tools but there were plenty that were out of compliance. I didn't want to take the time to individually check each VM (500+ VM's) so after some searching I found a script that showed me the tools version on the VM's that were out of compliance.


# Select Cluster you wish to scan "User VMs"#
PS > get-view -ViewType virtualmachine -SearchRoot (get-cluster "User VMs").id -Filter @{'Summary.Guest.ToolsVersionStatus'='guestToolsNeedUpgrade'} | Select Name,@{N='VMware Tools Version';E={$_.Config.Tools.ToolsVersion}},@{N='Tools Status';E={$_.Summary.Guest.ToolsVersionStatus}}


Append "| export-csv -path c:\tmp\vmware\vm_tools_upgrade.csv" for viewing and reporting purposes.

The output would show:

Name                                                   VMware Tools Version   Tools Status
VM_1                                                                                 8394  guestToolsNeedUpgrade
VM_2                                                                                 9344  guestToolsUpgrade

No comments:

Post a Comment