Powershell+task Scheduler+Excel. The script does not work, does not start Excel when you run the script from the scheduler. How to fix?

Good day!

I wrote a script that collects the info, puts it in Excel using a COM object. Saves and closes Excel.

If you just run under the user that everything is OK.

Put the startup in task scheduler and the script does not work..

Judging by the task Manager Excel is not even started.

I need not launch from the SYSTEM and from the domain user.

The user in the server administrators.

Please tell me how to solve the problem. Thanks in advance.
March 19th 20 at 08:26
5 answers
March 19th 20 at 08:28
but if a task in the scheduler to run from a specific domain user and remove the Run with highest privileges checkbox?
March 19th 20 at 08:30
The user under which you run the task scheduler is configured in the job configuration.
Please note that when run from the scheduler, usually the current directory is c:\windows\system32 and not the directory with the script. Often errors when running from the scheduler are linked to the fact that the script expects that the current directory is the directory where the script itself.
March 19th 20 at 08:32
Most likely in the settings is checked to run the job for the user who is logged on. But if in the system no one is logged on then the task in progress. Try to configure to run the job even if nobody is logged on to the system.
+ view the logs of the jobs in the same console. There will be written the error, why the job is not executed. If there was no error, it just does not even start and therefore was not fulfilled some of conditions.
March 19th 20 at 08:34
Usually the reasons are as follows -
Insufficient rights for user which is running.
Wrong way and the right environment when run from the scheduler.

Make sure that user has all necessary rights, make sure that paths are absolute and correct current directory.
To find out where exactly is the problem, use the debug - add to the script logging actions to a file.
March 19th 20 at 08:36
You need to change the value from "the Launching user" to "Current user" in the following location:
Control panel - administrative tools - component Services - Computers - My computer - DCOM config - Microsoft Excel Application - Properties - Identity.

Find more questions by tags Windows ServerExcelPowerShell