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:
1 2 3 4 | 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
1 2 3 4 | 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
1 | mmc.exe comexp.msc /32 |
and for System default
1 | mmc.exe comexp.msc |

Set permissions

Set the Launch and Activation permissions

and finally set the Access permissions

Michael