I was using the following code cmd /c $hash > $in 2>&1 to run a specific executable file using powershell. Here are the issues i face 

This commands works in PC but not servers.
This commands can run perfectly in manually way in server, but when schedule, it hit into error as following 

UnicodeEncodeError: 'charmap' codec cant encode characters in position 33-35: character maps to undefined
Kindly help.
As I know that I have faced same kind of issue when developing script in python & after lot of search I have found that I am facing charmap issue because of encoding issue.
What I need to do is set utf-8 as default encoding & after setting it in my python script I am able to solve above issue.
Try to set proper encoding while reading file or opening file & hope you will find solution for your problem.
Powershell Error when run the script automatically