2

This question would seem a very common question but i have done every possible thing for the solution but nothing works for me. I m trying to run a powershell script via batch powershell.exe c:\Powershell\process.ps1 process.ps1 - where my powershell script is present. I have encountered a strange problem, when i schedule the task in the windows task scheduler, it shows the operations has completed successfully but but when i check the results, Nothing happned. "The script did not run at all"

when i manually double click the batch, the script is running absolutely fine. My question is, when the script is running fine in batch manually, what could be the reasons of not running in task scheduler. Technically saying...the script is running in cmd.exe but not running on schedule (windows task scheduler 2008 server).

I tried checking each and every option in windows task scheduler, I operate task scheduler since ages. I am completely blank to understand the further troubleshooting steps. pls help

1
  • Just top add on my question, I have powershellv1.0 installed on my servers. Commented Feb 26, 2013 at 10:49

1 Answer 1

3

Is this any use? Creating a Scheduled task to run a PowerShell script
http://blogs.technet.com/b/heyscriptingguy/archive/2012/08/11/weekend-scripter-use-the-windows-task-scheduler-to-run-a-windows-powershell-script.aspx

In summary : in the Start a Program pane's Program/script box
powershell -file "path\and\script\filename.ps1"

1
  • I just gone through the link, looks like I have a solution. I reached home now. I will run that and will let you know the results..Thanks for your response. By the way..I am using the powershell script : $DateToDelete = 1 $StartFolder = "\\Network UNC path" dir $StartFolder -Recurse -Force -ea 0 | ?{!$_.PsIsContainer -and $_.LastWriteTime -lt (Get-Date).AddDays(-$DateToDelete)} | del -Force and i hope there wouldn't be any problem with its functionality. Commented Feb 26, 2013 at 16:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.