The root cause was that the computer running DOORs had a "System variable" of TEMP set to C:\Users\user-name\AppData\Local\Temp and there were no "User variables" set for TEMP.
To get the function working:
- The "System variable" for TEMP was changed to "%SystemRoot%\TEMP"
- Created another "System variable" called "TMP" and set it to "%SystemRoot%\TEMP" as well.
- Created 2 "User variables": TEMP and TMP and set those to "%USERPROFILE%\AppData\Local\Temp".