If you will search for “Powershell Script not running under scheduled task” , you will find dozens of article .
There are number of ways to achive that I basically use batch file approach but the issue I am talking about is a bit different.
Only one of my powershell script was not working under scheduled task , it was working fine when I run it in command shell but as soon as I schedule it nothing happens.
After digging a bit I found the issue , I was using excel com object in the script so to make it work under scheduled tasks below are two options:
Option 1 –> Select Run only when user is logged on when configuring scheduled task.
Option 2 –> Create a folder name Desktop under “C:\Windows\SysWOW64\config\systemprofile”
I have chosen option 2 as I find it best suited for my script to work seemlessly.
Note:- I have tested the solution on windows 2008..