Hi,
I am unable to capture the capture of below command to .csv or excel
Get-VM | Group-Object HardwareVersion
As I am getting the output error as below in the output file
Count | Name | Group |
781 | vmx-15 | System.Collections.ObjectModel.Collection`1[System.Management.Automation.PSObject] |
That is normal behaviour of the Expoert-Csv cmdlet.
When a property is not a singular value, but a collection, it will place the type of that property in that column in the CSV.
Assuming you want the names of the VMs on the HW version in the CSV, you could do something like
Select @{N='HWVersion';E={$_.Name}},
Count,
@{N='VM';E={$_.Group.Name -join '|'}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That is normal behaviour of the Expoert-Csv cmdlet.
When a property is not a singular value, but a collection, it will place the type of that property in that column in the CSV.
Assuming you want the names of the VMs on the HW version in the CSV, you could do something like
Select @{N='HWVersion';E={$_.Name}},
Count,
@{N='VM';E={$_.Group.Name -join '|'}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
oh, got it LucD.
Thank you very much. that worked