VMware Cloud Community
chakoe
Enthusiast
Enthusiast
Jump to solution

Checking virtualHardware-Version (VM Version)

Hi all,

i would like to read the Versions of all VM´s (VirtualHardware), because we have to update all VM´s with Version 3 to Version 4.

How do I read this with PowerClI?

Thx in advance

Chakoe

Reply
0 Kudos
1 Solution

Accepted Solutions
harkamal
Expert
Expert
Jump to solution

You can use Export-CSV cmdlet

$expOut = @()

Get-VM | %{
      code.....
      $expOut += $out
}

$expOut | Export-CSV c:\myFile.csv

Dont forget to click helpfull/correct button Smiley Happy

View solution in original post

Reply
0 Kudos
4 Replies
krowczynski
Virtuoso
Virtuoso
Jump to solution

With this line one would get every VM with the old hardware version.

Get-View -ViewType VirtualMachine | Where { $_.Runtime.PowerState -eq "poweredOn" } | Select Name, @{N="VMVersion"; E={$_.Config.Version}} | Where {$_.VMVersion -eq "vmx-04″} | Select Name

It should be an optional switch, because in a VI3 environment it would

MCP, VCP

MCP, VCP3 , VCP4
Reply
0 Kudos
harkamal
Expert
Expert
Jump to solution

Here you go mate..

Get-VM | Get-View | % { 
      $out = "" | Select VmName, Version
      $out.VmName = $_.Name
      $out.Version = $_.Config.Version

      $out
}

Reply
0 Kudos
chakoe
Enthusiast
Enthusiast
Jump to solution

Hi,

and how do i export the results into an csv-file? I know that it´s possible, but I´m still learning PowerShell / PowerCLI, so

I´m not a " pro " actually Smiley Happy

thx

Chakoe

Reply
0 Kudos
harkamal
Expert
Expert
Jump to solution

You can use Export-CSV cmdlet

$expOut = @()

Get-VM | %{
      code.....
      $expOut += $out
}

$expOut | Export-CSV c:\myFile.csv

Dont forget to click helpfull/correct button Smiley Happy

Reply
0 Kudos