I figured out the problem by stumbling across this post:
https://winscp.net/forum/viewtopic.php?t=12315
Hopefully this will help others. Being a powershell newbie I was not aware of the need to escape certain characters in strings. If the strings are put in single quotes and not double there is no need to escape those characters. Since my password had an illegal powershell character, I changed it to single quotes and it was fine. This would explain why my winscp script would work fine, but not the powershell script. See this page as well for escaping in powershell:
https://www.rlmueller.net/PowerShellEscape.htm