VMware Cloud Community
chakoe
Enthusiast
Enthusiast
Jump to solution

DIscover VMWare-Tools-Version

Hi,

i tried to build a script to discover the Versions of the installed VMWare-Tools on my Guest, display it and write it to an CSV-File.

Here´s the actual content:

$vmview = Get-VM |Sort-Object {$_.Name} | Get-View

$vmview.Config.Tools | Select ToolsVersion | Write-Host #|Export-CSV "C:
Script_Outputs\VM_Tools_Version_$wann.csv" -noTypeInformation

My problem is:

The script shows the Version of the installed tools, but it doesn´t show the name Smiley Happy

How do i add the the Name to the script?

Thx in advance

Chakoe

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Sure, something like this

Get-VM |Sort-Object {$_.Name} | Get-View | `
	where {$_.Config.Tools.ToolsVersion -eq "7202"} | `
	Select Name, @{N="Version";E={$_.Config.Tools.ToolsVersion}}

____________

Blog: LucD notes

Twitter: lucd22


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

View solution in original post

0 Kudos
4 Replies
RvdNieuwendijk
Leadership
Leadership
Jump to solution

You can add the VM name to the script like this:

$vmview = Get-VM |Sort-Object {$_.Name} | Get-View
$vmview | ForEach-Object {
  $Report = "" | Select-Object Name,ToolsVersion
  $Report.name = $_.Name
  $Report.ToolsVersion = $_.Config.Tools.Toolsversion
  $Report
} | Export-CSV "C:\\Script_Outputs\VM_Tools_Version_$wann.csv" -noTypeInformation 

Regards, Robert

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos
LucD
Leadership
Leadership
Jump to solution

You can do it like this

Get-VM |Sort-Object {$_.Name} | Get-View | Select Name, @{N="Version";E={$_.Config.Tools.ToolsVersion}}

____________

Blog: LucD notes

Twitter: lucd22


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

0 Kudos
chakoe
Enthusiast
Enthusiast
Jump to solution

Hi,

the Script works fine.

Now there´s a new question:

Is it possible to seachr for all vm´s which have a ToolsVersion=7202 ?

Thx in advance

Chakoe

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Sure, something like this

Get-VM |Sort-Object {$_.Name} | Get-View | `
	where {$_.Config.Tools.ToolsVersion -eq "7202"} | `
	Select Name, @{N="Version";E={$_.Config.Tools.ToolsVersion}}

____________

Blog: LucD notes

Twitter: lucd22


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

0 Kudos