VMware Cloud Community
pamiller21
Enthusiast
Enthusiast

VMware Tools & Hardware Version Report

Hey all,

I currently have a script made that exports to a csv the VMs in my infrastructure that need their VMtools updated or simply are not running either.  I would like to do the same for hardware version too. 

Example of current report:

NameToolsStatus
VM1toolsNotInstalled
VM2toolsOld
VM3toolsNotRunning

What I would like is a third column showing hardware versions.

Here is my script as is:

add-pssnapin VMware.VimAutomation.Core
Connect-VIServer 127.0.0.1 -Protocol https -User <USER> -Password <PW>

Get-View -ViewType VirtualMachine -Property Name,Guest.ToolsStatus,Config.Template,Runtime.PowerState -Filter @{

  "Config.Template"="False";"Runtime.PowerState"="poweredOn";"Guest.ToolsStatus"="^(?!toolsOk$).*$" } |

Select-Object Name,@{Name="ToolsStatus";E={$_.Guest.ToolsStatus}} |

Export-CSV -Path "<DIR>" -NoTypeInformation -UseCulture

Thanks for all the help,

Andy

Reply
0 Kudos
1 Reply
clbarnett90
Contributor
Contributor

Just change your select statement.
Select-Object Name,@{Name="ToolsStatus";E={$_.Guest.ToolsStatus}}

should become this
Select-Object Name,@{Name="ToolsStatus";E={$_.Guest.ToolsStatus}},version

Reply
0 Kudos