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 jus 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 run from 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 ?
Thanks in advance