The problem is that the Export-CSV cmdlet looks at the properties of the first record it reads and outputs only those properties for all the records. You can let the script write a dummy record as the first record with all the columns that are possible. That will solve this problem.
↧