Solved

Scheduled task not running on 2008 server

Posted on 2013-11-18
11
624 Views
Last Modified: 2013-11-18
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
Comment
Question by:sirbounty
  • 5
  • 4
  • 2
11 Comments
 
LVL 35

Assisted Solution

by:Joseph Daly
Joseph Daly earned 63 total points
Comment Utility
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
 
LVL 67

Author Comment

by:sirbounty
Comment Utility
Have tried it that way, as well as with the -file parameter preceeding the script
0
 
LVL 35

Expert Comment

by:Joseph Daly
Comment Utility
Can you post the script?
0
 
LVL 40

Assisted Solution

by:Subsun
Subsun earned 187 total points
Comment Utility
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
 
LVL 67

Author Comment

by:sirbounty
Comment Utility
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
Are end users causing IT problems again?

You’ve taken the time to design and update all your end user’s email signatures, only to find out they’re messing up the HTML, changing the font and ruining the imagery. What can you do to prevent this? Find out how you can save your signatures from end users today.

 
LVL 40

Accepted Solution

by:
Subsun earned 187 total points
Comment Utility
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
 
LVL 67

Author Comment

by:sirbounty
Comment Utility
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
 
LVL 40

Assisted Solution

by:Subsun
Subsun earned 187 total points
Comment Utility
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
 
LVL 40

Expert Comment

by:Subsun
Comment Utility
Also check the PowerShell Execution Policy using command Get-ExecutionPolicy
0
 
LVL 67

Author Comment

by:sirbounty
Comment Utility
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
 
LVL 67

Author Comment

by:sirbounty
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

How to sign a powershell script so you can prevent tampering, and only allow users to run authorised Powershell scripts
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now