Can't know for sure but I'm assuming the script is failing because of missing privileges.
- If the privileges needed for this to work are some Windows stuff like read/write files or start an app, you likely can bypass it in Task Scheduler Security options for a task - check options "Run whether user is logged on or not" and "Run with highest privileges"
- If these are some form of file-protection-privileges (i.e. only some identified users can do something with files), then you most likely should directly point the user running this task in the options. But if this type of protection involves some auth token or similar things - I think it won't be possible (because it equals to auto-login as user, which is kinda destroys the purpose).