• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 657
  • Last Modified:

Scheduled task not running on 2008 server

I have a powershell script I'm trying to schedule.
I can kick it off manually, but it's not completing if I launch it from Task Scheduler (nor wait for it).
History shows it's running, but I even dropped a line at the start to kick out a test file, and it's not appearing.
Since I'm not getting any errors, I'm not sure where to start, but I've created the task as I've found it outlined elsewhere...
0
sirbounty
Asked:
sirbounty
  • 5
  • 4
  • 2
4 Solutions
 
Joseph DalyCommented:
In the options for the scheduled taks under actions it should read.

Start a Program

Program/Script
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

Parameters
c:\location\powershell.ps1

Is this how you have it configured?
0
 
sirbountyAuthor Commented:
Have tried it that way, as well as with the -file parameter preceeding the script
0
 
Joseph DalyCommented:
Can you post the script?
0
 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

 
SubsunCommented:
If the script is working when you run it from PowerShell console then add the following line as the first line of script and run it from schedule teask.. once it's complete check the c:\temp\log.txt for error details..

start-transcript -path c:\temp\log.txt
0
 
sirbountyAuthor Commented:
xxdcmast - I can wipe out the entire script, leaving
'test' |out-file 'c:\temp\temp.txt'
and it doesn't work...

Subsun - the file isn't produced.
0
 
SubsunCommented:
That's strange or probably script is not running at all..  I would check if the account which you use to run script on task scheduler have proper permission to run the task. Second Try to run task with "Run with highest privileges" checked..
0
 
sirbountyAuthor Commented:
Run with highest is already checked.
Narrowing it down a bit, scheduling a simple cmd style dir listing redirect doesn't produce output either under that account.
What permissions are needed to run a task?
0
 
SubsunCommented:
I think logon as a batch job will do.. or just add the account to local admin group and test.. What does the schedule task history says?

Here is a reference for creating schedule task for 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
0
 
SubsunCommented:
Also check the PowerShell Execution Policy using command Get-ExecutionPolicy
0
 
sirbountyAuthor Commented:
Account belongs to a group providing Logon as a batch and locally...so I'm stumped.

The 'test' job shows

Task Scheduler failed to start "\test" task for user "****\******". Additional Data: Error Value: 2147943645.

(I do not have 'start in' values entered, so the 'remove quotes' solution won't work here)
0
 
sirbountyAuthor Commented:
Sometimes just asking the question will lead you to the answer...had a brain slip ;^)
I was using that account to access a local folder and the perms are set at the share level, so I just had to access it via a unc and it appears to be working.
Thanks for the help!
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

  • 5
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now