Try to move the piping to Export-CSV to the last line of the script.
↧
Try to move the piping to Export-CSV to the last line of the script.