Excel: Does not start within a schedule task

Hi,

if you have already created a script and within you do some things with Excel by DCOM Excel.Application the script runs well as a user logged to the Desktop but not within a schedule task started by the same user.

The root cause are some missing folders and permissions in the systemprofile folder and missing DCOM Permissions to launch Excel.

Start a command shell cmd.exe with Administrator permissions and create the following folders if it not exists:

mkdir C:\Windows\SysWOW64\config\systemprofile\AppData
mkdir C:\Windows\SysWOW64\config\systemprofile\Desktop
mkdir C:\Windows\System32\config\systemprofile\AppData
mkdir C:\Windows\System32\config\systemprofile\Desktop

Then set Modify permissions for the user who should start excel

icacls C:\Windows\SysWOW64\config\systemprofile\AppData /grant myDomain\myUser:(OI)(CI)(R)(RX)(M)
icacls C:\Windows\SysWOW64\config\systemprofile\Desktop /grant myDomain\myUser:(OI)(CI)(R)(RX)(M)
icacls C:\Windows\System32\config\systemprofile\AppData /grant myDomain\myUser:(OI)(CI)(R)(RX)(M)
icacls C:\Windows\System32\config\systemprofile\Desktop /grant myDomain\myUser:(OI)(CI)(R)(RX)(M)

Open DCOM Configuration. Depending of our Office Version (x86 or x64). For a 32Bit Office

mmc.exe comexp.msc /32

and for System default

mmc.exe comexp.msc

DCOM Management Console

Set permissions
DCOM Permissions

Set the Launch and Activation permissions
DCOM Launch and Activation Permissions

and finally set the Access permissions
DCOM Access Permissions

Michael

Advertisment to support michlstechblog.info

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.