I'm running the following query from a powershell command which unfortunately truncates or adds dots to the end of the result string. I had adjusted the screen buffer size for powershell i.e. right click on powershell Properties>Layout>Screen Buffer Size> width and height set to 9999 (max). It seems like the output is limited to the powershell screen buffersize and I can't seem to get around this one. Any help is appreciated please.
Invoke-Sqlcmd -ServerInstance myrds.com -Database mydb -Username dbuser -Password passord -maxcharlength 80000 -Query "SELECT CAST(BINARYCOL AS VARCHAR(MAX)) FROM OLTP_TABLE WHERE ID=123123 AND COMPANYID=123" | Out-File -FilePath "C:\Users\USER\Documents\ps_scripts\res3.txt"