0

I have a powershell script that generates a report and exports it out as an excel file and then emails it as an attachment.

This works perfectly when I run the powershell script, I then created a batch script that calls this powershell script and when I run the batch command it also works.

I then created a task in task scheduler and set it to run the batch command, when I execute it on command it works. However when I set it to run at designated times, it will generate the report and send the email but will not attach the spreadsheet in the email.

henrycarteruk
  • 12,708
  • 2
  • 36
  • 40
Esogaco
  • 1
  • 5
  • 1
    Please post code, ideally a [mcve](https://stackoverflow.com/help/mcve) – G42 Jul 20 '17 at 14:30
  • I'll hazard a guess : relative paths and different execution context ; try to execute your batch script from another directory and see if it still works – Aaron Jul 20 '17 at 14:31
  • [Related](https://stackoverflow.com/a/41635982/1630171). – Ansgar Wiechers Jul 20 '17 at 14:33
  • To say the least, task scheduler has quirks. Please post the XML of the scheduled task. – Maximilian Burszley Jul 20 '17 at 14:46
  • Thanks Guys, I finally figured it thanks to Aaron. I had modified the PS Script but did not save it in the same folder so that task scheduler was still running the un modified script. It's working now. thanks again. Really love this forum – Esogaco Jul 20 '17 at 15:15

0 Answers0