I suspect this is going to be a long shot. I have a reg backup that Windows Tasks runs every evening at 8PM. It calls ERUNT and gives it this command:
F:\System\Reg\Erunt\ERUNT.EXE D:\RegBack\xxx /noconfirmdelete
(xxx=day of week)
ERUNT deletes the contents of an existing folder and then writes today's reg backup to that folder. I've been running this same setup for yrs w/ 100% reliability.
A few weeks ago I installed DOpus and since then at least 1 evening a week - although w/o a set pattern - i'll get an error message from ERUNT saying:
"The contents of folder D:\RegBack\xxx could not be completely deleted!"
And sure enough if I check the folder it has last weeks data in it. I then run the ERUNT command manually and it works fine. (No space issues on that partition) This always happens when DOPus is running in the background and i'm using some other program.
You could try modifying the script your scheduled task runs to maybe fire up procmon, attempt the normal operation, then terminate procmon and save off the log for review. I suppose there should be something in the log referencing the file your script is trying to replace...?
Because, as I mentioned, this app ran w/ 100% reliability for at least 5 yrs - until I installed DOpus. The 1st week after the install I was tweaking DOpus a lot and I got the error message 3 times in that week. Since then i'm always in my browser at 8PM and DOpus is always open & running in the background. And since that first week I get the error at least once a week.
I suppose I could turn off DOpus for a couple of weeks to see if the errors go away but that would be a pain.