I have a large data set in a CSV file of which I'm attemting to update the records without success.
Here is what I have:
$MailData = Import-Csv $MailDB -Delimiter '|'
$update = $MailData | ForEach-Object {
  if ($_.subject -like 'GGN*') {
    $_.status = 1
    $_.status_modified = (Get-Date).ToString('yyyy-MM-dd HH-mm-ss')
  }
}
$update | Export-Csv $MailDB -Delimiter '|' -NoTypeInformation
I've also tried the -Append switch and tried to do it with Set-Content. In all cases the content of $MailData is changed, but when I re-import the CSV file the data is not updated.
 
    