Quick way to convert CSV types to original types with PowerShell's Import-Csv cmdlet?
I'm using PowerShell v2 and have a custom type I've defined called Material using code like this: add-type @" public struct Material { public string BusinessUnit; public string Source; public string PrimarySource; public string LegacyMaterialNumber; } "@ ...and I've got a collection of objects of this type I'm writing to a CSV file using the Export-Csv cmdlet. That works fine and produces data with the original type specified like this: #TYPE Material BusinessUnit,Source,PrimarySource,LegacyMaterialNumber BU1,NAFO,NAFO-FG,17502 BU1,NAFO,NAFO-FG,17504 BU1,NAFO,NAFO-FG,17739 BU1,NAFO,NAFO-FG