Are you able to sanitize and post the script?
If not, can you comment out certain pieces of your script to see if it works. I might even start with commenting out the entire thing so that it essentially does nothing, and deploying to see what happens. It would at least help to verify if it is a function that the script is performing, or something above that.
Also, please make sure that is a valid, accessible share. I know you sanitized that piece, but when I read \\domain.com it makes me wonder if you glazed over the server location.