PowerCLI

 View Only
  • 1.  Checking virtualHardware-Version (VM Version)

    Posted Oct 20, 2009 05:56 AM

    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



  • 2.  RE: Checking virtualHardware-Version (VM Version)

    Posted Oct 20, 2009 06:42 AM

    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



  • 3.  RE: Checking virtualHardware-Version (VM Version)

    Posted Oct 20, 2009 07:33 AM

    Here you go mate..

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



  • 4.  RE: Checking virtualHardware-Version (VM Version)

    Posted Oct 20, 2009 01:19 PM

    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 :smileyhappy:

    thx

    Chakoe



  • 5.  RE: Checking virtualHardware-Version (VM Version)
    Best Answer

    Posted Oct 20, 2009 01:25 PM

    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 :smileyhappy: