I wrote a PowerShell script that opens an excel workbook and runs a macro. When I run that script from PS console, or even from command line using powershell.exe script.ps1, it just works. When I set up a task from the windows task scheduler, it raises an exception about that Excel file, saying that it either does not exist or is already in use.
The file exists for sure, as the script ran fine from the command line, and I'm positive it is not in use.
I tried to move the Excel file to a local and non-privileged area, to avoid network trust/admin privilege issues. The task still runs with highest privileges. The path has no spaces, or special characters.
When I try to access to the file using a File system object, there is no errors even when run from the scheduler, so I guess it is specific to Excel.Application.Workbooks.Open("..")
method.
What should I consider now?