Worked this around by putting the script into the text file and running this from the job step:
c:\temp\DSM.ps1
Everything works now, but it would be interesting to find out how to make it work when the script is inside the job step, as synchronizing those text files across multiple servers is a bit of a headache.