I'm outputting a couple of objects from a data table to a .csv file and wanted to change the object names.
This works fine:
$dataset.tables[0] | select-object System.ItemName, System.ItemPathDisplay | Export-Csv -Path D:\SEARCH_RESULT.csv -NoTypeInformation
However I'd like to change System.ItemName to SKU and have tried the following:
$dataset.tables[0] | select-object @{N='SKU';E={$_.System.ItemName}}, System.ItemPathDisplay | Export-Csv -Path D:\SEARCH_RESULT.csv -NoTypeInformation
This gives the right column heading but blank rows. So tried this which give rows but they all say SYSTEM.ITEMNAME:
$dataset.tables[0] | select-object @{N='SKU';E={$dataset.tables[0].Columns['SYSTEM.ITEMNAME']}}, System.ItemPathDisplay | Export-Csv -Path D:\SEARCH_RESULT.csv -NoTypeInformation
Clearly I'm not referencing the object correctly. Any help greatly appreciated.