We finally managed to solve this issue by looking at the “servertasks.txt” log file that is written on the Octopus server.
Luckily we were running other powershell scripts (without error) in the deploy so it was possible to compare one that worked vs. one that failed.
Here are two log lines that I compared against each other from the server log file.
[“ServerTasks-”,“VBS”,“2021-01-19T13:34:06.5367435+00:00”,“Executing \u0027E:\Octopus\Work\20210119133404-76545-52\Scripts/Deploy/DBscripts/SetProdDatabaseInReadOnlyQA.ps1 \u0027”,"",0]
Compare against the error message you see in Octopus:
As you can see from the servertask log file, one script is referenced as “.ps1 \u0027” and the other as “.ps1\u0027” - this is very hard to spot in the error message printed out in Octopus GUI.
I edited the deploy process to removed the extra blankspaces and now the deploy works.
Should add that before we updated to 2020.04 of Octopus these scripts ran without issue.
So there seems to have been introduced a bug (possibly related to UTF8?) where referenced powershell scripts will fail with a message that ".ps1 "(note the extra space, that we didn’t notice to begin with) is an unknown extension if the step template has an extra blank space after the referenced script.