T
T
TechNOIR2019-03-25 11:55:18
PowerShell
TechNOIR, 2019-03-25 11:55:18

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

Good afternoon!
I wrote a script that collects information, puts it into Excel using a COM object. Saves and closes Excel.
If you just run under the user, then everything is OK.
I put the launch in the scheduler and the script does not work ..
Judging by the Task Manager, Excel does not even start.
I need a launch not from the SYSTEM, but from the domain user.
User in server administrators.
Please tell me how to solve the problem. Thanks in advance.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
azarij, 2019-03-25
@azarij

and if the task in the scheduler is run from a specific domain user and remove the Run with highest privileges checkbox?

R
res2001, 2019-03-25
@res2001

The user under which the task is launched is configured in the scheduler in the task settings.
Note that when run from the scheduler, the current directory is usually c:\windows\system32, not the script directory. Often errors when running from the scheduler are related precisely to the fact that the script expects the current directory to be the directory where the script itself is located.

S
Sergey Ryzhkin, 2019-03-25
@Franciz

Most likely, there is a checkmark in the settings so that the task is performed for users who have logged in. And if no one entered the system, then the task is not executed. Try setting it up so that the task runs even if no one is logged on.
+ look at the job logs in the same console. An error will be written there, why the task was not completed. If there was no error, then it simply did not even start, and therefore some of the conditions were not met.

A
Artyom Gushchin, 2019-07-22
@PoZuTPoH

You need to change the value from "Running User" to "Current User" in the following location:
Control Panel - Administrative Tools - Component Services - Computers - My Computer - DCOM Setup - Microsoft Excel Application - Properties - Identity.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question