Hi,
I am unable to export the output to csv file, please help
$info = @()
$esxName = '10.10.10.10'
$esxcli = Get-EsxCli -VMHost $esxName
foreach($dev in $esxcli.hardware.pci.list()){
if($dev.ModuleName -ne 'None'){
$esxcli.system.module.get($dev.ModuleName) |
Select @{N='Device';E={$dev.DeviceName}},@{N='DeviceClass';E={$dev.DeviceClassName}},Module,Version
}
}
$info | Export-Csv ".\ESXi_Info0.csv" -NoTypeInformation -UseCulture
Try like this.
There is no need to fill the $info array, just export what comes through the pipeline.
$esxcli = Get-EsxCli -VMHost $esxName
$esxcli.hardware.pci.list() |
where { $_.ModuleName -ne 'None' } |
ForEach-Object -Process {
$dev = $_
$esxcli.system.module.get($dev.ModuleName) |
Select @{N = 'Device'; E = { $dev.DeviceName } },
@{N = 'DeviceClass'; E = { $dev.DeviceClassName } }, Module, Version
} |
Export-Csv ".\ESXi_Info0.csv" -NoTypeInformation -UseCulture
------------------------------------------------------------------------------------------------------
Was it helpful? Let us know by completing this short survey here.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Try like this.
There is no need to fill the $info array, just export what comes through the pipeline.
$esxcli = Get-EsxCli -VMHost $esxName
$esxcli.hardware.pci.list() |
where { $_.ModuleName -ne 'None' } |
ForEach-Object -Process {
$dev = $_
$esxcli.system.module.get($dev.ModuleName) |
Select @{N = 'Device'; E = { $dev.DeviceName } },
@{N = 'DeviceClass'; E = { $dev.DeviceClassName } }, Module, Version
} |
Export-Csv ".\ESXi_Info0.csv" -NoTypeInformation -UseCulture
------------------------------------------------------------------------------------------------------
Was it helpful? Let us know by completing this short survey here.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you very much LucD.
That worked