locked
task scheduler task failing to update excel sheet with powershell RRS feed

  • General discussion

  • hi,

    am using powershell to update diskspace report to an excel sheet and mail it to team.

    the script is working fine when running manually.

    when i schedule it using task scheduler and choose to run only when user is logged on, the task is running fine.

    but, when i schedule it using task scheduler and chnage to run when user is not logged on, the script is failing to update the excel sheet and mailing old excel sheet.

    i cannot keep my user session logged in.

    please help.

    thanks in advance.


    Ekachakra

    • Changed type Bill_Stewart Friday, July 27, 2018 6:30 PM
    • Moved by Bill_Stewart Friday, July 27, 2018 6:30 PM This is not "scripts on demand"
    Tuesday, May 1, 2018 8:38 PM

All replies

  • Hi,

    This is a scripting questions forum. If you script works when you run it standalone, then you don't have a scripting question per se.

    That said: Excel is not designed to be automated using the Task Scheduler tool. You might get assistance by asking in an Office development forum.


    -- Bill Stewart [Bill_Stewart]

    Tuesday, May 1, 2018 8:40 PM
  • See the following: Considerations for server-side Automation of Office

    "All current versions of Microsoft Office were designed, tested, and configured to run as end-user products on a client workstation. They assume an interactive desktop and user profile. They do not provide the level of reentrancy or security that is necessary to meet the needs of server-side components that are designed to run unattended.

    Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

    If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution. "

    Note that "NT Services" is included and the "Task Scheduler" is an NT service.


    \_(ツ)_/


    • Edited by jrv Tuesday, May 1, 2018 8:45 PM
    Tuesday, May 1, 2018 8:44 PM
  • hi,

    am using powershell to update diskspace report to an excel sheet and mail it to team.

    the script is working fine when running manually.

    when i schedule it using task scheduler and choose to run only when user is logged on, the task is running fine.

    but, when i schedule it using task scheduler and chnage to run when user is not logged on, the script is failing to update the excel sheet and mailing old excel sheet.

    i cannot keep my user session logged in.

    please help.

    thanks in advance.


    Ekachakra

    • Merged by Bill_Stewart Tuesday, May 1, 2018 9:04 PM Duplicate
    Tuesday, May 1, 2018 8:52 PM