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
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
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
Here you go mate..
Get-VM | Get-View | % { $out = "" | Select VmName, Version $out.VmName = $_.Name $out.Version = $_.Config.Version $out }
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
thx
Chakoe
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