I am using the script written by William Lam called "Get-ESXiBootDevice" (https://www.powershellgallery.com/packages/AsBuiltReport.VMware.vSphere/1.2.1/Content/Src%5CPrivate%5CGet-ESXiBootDevice.ps1) and it exports the data correctly to the console:
Get-ESXiBootDevice *
Host Device BootType Vendor Model SizeMB IsSAS IsSSD IsUSB
---- ------ -------- ------ ----- ------ ----- ----- -----
MyHost01.MyDomain naa.600a098038303455575d484d46442f59 remote NETAPP LUN C-Mode 10240 false false false
MyHost02.MyDomain naa.600a098038303455575d484d46442f2f remote NETAPP LUN C-Mode 10240 false false false
MyHost03.MyDomain naa.600a098038303455575d484d46442f5a remote NETAPP LUN C-Mode 10240 false false false
However, now when I try to export the results to a CSV, I get this in the CSV file:
et-ESXiBootDevice * | export-csv -Path MyvCenter_Host_BootDevices.csv -NoTypeInformation -UseCulture
"ClassId2e4f51ef21dd47e99d3c952918aff9cd","pageHeaderEntry","pageFooterEntry","autosizeInfo","shapeInfo","groupingEntry"
"033ecb2bc07a4d43b5ef94ed5a35d280",,,"Microsoft.PowerShell.Commands.Internal.Format.AutosizeInfo","Microsoft.PowerShell.Commands.Internal.Format.TableHeaderInfo",
"9e210fe47d09416682b841769c78b8a3",,,,,
"27c87ef9bbda4f709f6b4002fa4af63c",,,,,
"27c87ef9bbda4f709f6b4002fa4af63c",,,,,
"27c87ef9bbda4f709f6b4002fa4af63c",,,,,
"27c87ef9bbda4f709f6b4002fa4af63c",,,,,
"27c87ef9bbda4f709f6b4002fa4af63c",,,,,
I even wrote code to loop thru each host individually and return the results with the same outcome:
$oVMHosts = Get-VMHost *
$HostBootDevices = @()
ForEach ($oVMHost in $oVMHosts)
{
$VMHostBootDevice = Get-ESXIBootDevice ($oVMHost)
$HostBootDevices += $VMHostBootDevice
}
$HostBootDevices | export-csv -Path MyvCenter_Host_BootDevices.csv -NoTypeInformation -UseCulture
What is the correct way to export the data to CSV?