none
Script Doesn't Copy Folders As Scheduled Task RRS feed

  • General discussion

  • Hi. I wrote a script to move files from a network share to a local folder. The script works when its run locally in PowerShell, but when I run it as a scheduled task, folders aren't copied.

    This is the script:
    https://github.com/johancyprich/CleanUp-FileAttachments

    ----------------------

    These are the settings for the scheduled task:

    General:

    • run whether user is logged in or not
    • run with highest privileges
    Actions:
    • action: start a program
    • program/script: Powershell.exe
    • add arguments: -ExecutionPolicy Bypass D:\Scripts\CleanUp-FileAttachments\CleanUp-FileAttachments.ps1

    ----------------------

    The transcript log that is created shows the domain administrator logged in. What do I need to do to get the script to move files as a scheduled task?

    Any help would be greatly appreciated.

    • Changed type Bill_Stewart Friday, July 7, 2017 4:26 PM
    • Moved by Bill_Stewart Friday, July 7, 2017 4:27 PM This is not task scheduler/basics of command line forum
    Thursday, May 4, 2017 12:11 AM

All replies

  • What are the errors?

    Please post you script here and not as a reference to a remote project.  We cannot navigate or determine what you are doing from github as it is a non-PowerShell project. We do not support third party tools here.


    \_(ツ)_/


    • Edited by jrv Thursday, May 4, 2017 12:26 AM
    Thursday, May 4, 2017 12:23 AM
    • action: start a program
    • program/script: Powershell.exe
    • add arguments: -ExecutionPolicy Bypass D:\Scripts\CleanUp-FileAttachments\CleanUp-FileAttachments.ps1
    You are missing the -File parameter for powershell.exe. Run "powershell /?" for information on the command-line arguments to powershell.exe.

    -- Bill Stewart [Bill_Stewart]

    Thursday, May 4, 2017 3:12 PM