I have a script that downloads a temporary Excel file, copies parts of it to a new file, and saves it to a specific location on the network.
The problem is that the new file is never created/saved. If I run the script locally (through cmd.exe, PowerShell, or PowerShell ISE), it WILL save the file locally, or to the network. If I try running the script via a schedule or on-demand via Task Scheduler, the temporary file is created, but the final document is never created or saved. Is there a specific argument I need to pass, or anything I could be doing wrong? This is the command I'm currently using:
powershell.exe -file C:\path\to\my\powershell\script\thescript.ps1
Since it calls environment variables, and other variables relative to the scripts positon, I also set "Start in" to
C:\path\to\my\powershell\script\
I have tried using
\\MYSERVER\Path\To\Directory\file.xlsx
as the location for the file on the network (as suggested here), but this does not work either.