$line = $line -replace "\|", ";"
Although this should have worked too:
$line = $line.Replace("|", ";")
Note: Strings in .NET are immutable (why?). Operations like
Replace don’t change the original string, so you have to assign the result back to
CLICK HERE to find out more related problems solutions.