So, I'm not sure why you have most of that in the script since the TrimEnd gets rid of all the extra pipe characters from the last question you asked that I saw, but anyway, does this do what you want?
gc .\oauthrn.cms |
% {$_.TrimEnd("|")} |
out-file "H:\Documentation\Scripts\Pipe Delimiter Project\ShineyNewFile.txt" -encoding ascii
Rename-Item "H:\Documentation\Scripts\Pipe Delimiter Project\ShineyNewFile.txt" "oauthrn.cms"
gc .\oauthrn1.cms |
% {$_.TrimEnd("|")} |
out-file "H:\Documentation\Scripts\Pipe Delimiter Project\ShineyNewFile1.txt" -encoding ascii
Rename-Item "H:\Documentation\Scripts\Pipe Delimiter Project\ShineyNewFile1.txt" "oauthrn1.cms"