Error in copying the files via Task-scheduler by running Powershell script RRS feed

  • Question

  • Hi Guys,

    I am trying to copy files from a Network location to a local folder using Powershell scripting. The very strange thing is, when I run this script via Powershell ISE it working fine. But when i run this script via Windows Task Scheduler from the same machine, it is unable to copy files. It is even unable to see the files in the network drive.

    Eg: when i run this command via Windows Task-scheduler, i.e. $(ls $(Network_Location_Name) | Measure-Object -Property Length -Sum).Count | outfile FileName.log, the result is ZERO !

    Please help and thanks in advance! 




    • Moved by Bill_Stewart Thursday, December 20, 2018 9:14 PM Unanswerable drive-by question
    Monday, October 15, 2018 7:30 PM

All replies

  • What script? 

    Note that this is not a Task Scheduler forum.

    The task scheduler does not have access to network resource by default.  The task must be provisioned correctly. 

    Post In the OS forum for your OS to get help with the TS.


    Monday, October 15, 2018 8:54 PM
  • What account are you running the ST as? If it's system then it does not have access to external resources. You can run it as network server assuming the machine has the required access to the remote share or you can use a domain service account.
    Tuesday, October 16, 2018 12:13 AM
  • Hi guys,

    If you could send me the link to the correct group, that would be great!

    Also I made sure I am running the task with a service account which has full access to the Network location from where it is copying the files.

    Thanks for your help!



    Tuesday, October 16, 2018 2:12 PM