none
Issue with PowerShell script running in task scheduler RRS feed

  • Question

  • I have a powershell script which fetches some reports in excel sheet. When i run that script manually it is working fine and giving the desired output(i.e. creating a report in .xlsx format). While running that script with task scheduler is giving below error:

    • "Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))."

    So i searched on google for this issue and i found a solution which is:

    1. In DCOMCNFG, right click on the My Computer and select properties. 
    2. Choose the COM Securities tab
    3. In Access Permissions, click "Edit Defaults" and add Network Service to it and give it "Allow local access" permission. Do the same for <Machine_name>\Users.
    4. In launch and Activation Permissions, click "Edit Defaults" and add Network Service to it and give it "Local launch" and "Local Activation" permission. Do the same for <Machine_name>\Users


    After applying this solution, this error got resolved but now i am getting another error which is mentioned below:

    • "Microsoft Excel cannot open or save any more documents because there is not enough available memory or disk space.   • To make more memory available, close workbooks or programs you no longer need.   • To free disk space, delete files you no longer need from the disk you are saving to."

    I have tried searching on google but i found no solution. So please help me with the issue so that i can eliminate the error and complete my work. 

    Microsoft Office 365 pro plus is installed in my system.



    • Edited by sa_ag Monday, October 16, 2017 9:50 AM
    • Moved by Bill_Stewart Wednesday, November 29, 2017 6:39 PM This is not "run office application in scheduled task" support forum
    Monday, October 16, 2017 7:26 AM

All replies

  • You cannot run Excel as a task.  Non-interactive sessions are not allowed with all Office products.


    \_(ツ)_/

    Monday, October 16, 2017 10:00 AM
  • Can you please elaborate?

    I am not running excel as a task. I am running PowerShell script which is generating a excel report.

    It was working fine when i created this script but i don't know what happened with the server configuration so its not working now.


    Monday, October 16, 2017 11:39 AM
  • Does the script use the Excel COM object?


    \_(ツ)_/

    Monday, October 16, 2017 11:51 AM
  • yes it uses excel com object.

    but earlier it was working with excel com object.

    • Edited by sa_ag Monday, October 16, 2017 1:19 PM
    Monday, October 16, 2017 1:17 PM
  • Excel COM object is not supported in the task scheduler or as a service.  It must be run from an interactive session.

    Yes.  Sometimes it will work.  It also will leaves objects in memory and cause issues.  Many have tried.  Most have eventually given up because it is unreliable.

    You can use the OpenOffice SDK to edit Excel from a task or look in the Gallery for the Excel module which uses the SDK.  It can be run under the task sched.

    You can also use OLEDB to query and update excel sheets.


    \_(ツ)_/

    Monday, October 16, 2017 1:33 PM
  • Can we use OpenOffice SDK with PowerShell?

    If yes Please let me know.

    Monday, October 16, 2017 3:25 PM
  • Look in Gallery for a module that uses the SDK or:

    find-module psexcel | import-Module


    \_(ツ)_/

    Monday, October 16, 2017 3:27 PM