Solved

Scheduled task not running on 2008 server

Posted on 2013-11-18
11
641 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
11 Comments
 
LVL 35

Assisted Solution

by:Joseph Daly
Joseph Daly earned 63 total points
ID: 39656820
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
ID: 39656839
Have tried it that way, as well as with the -file parameter preceeding the script
0
 
LVL 35

Expert Comment

by:Joseph Daly
ID: 39656850
Can you post the script?
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 40

Assisted Solution

by:Subsun
Subsun earned 187 total points
ID: 39656888
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
ID: 39656914
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
 
LVL 40

Accepted Solution

by:
Subsun earned 187 total points
ID: 39656990
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
ID: 39657019
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
ID: 39657230
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
ID: 39657249
Also check the PowerShell Execution Policy using command Get-ExecutionPolicy
0
 
LVL 67

Author Comment

by:sirbounty
ID: 39657263
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
ID: 39657404
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

Increase Agility with Enabled Toolchains

Connect your existing build, deployment, management, monitoring, and collaboration platforms. From Puppet to Chef, HipChat to Slack, ServiceNow to JIRA, Splunk to New Relic and beyond, hand off data between systems to engage the right people.

Connect with xMatters.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
This tutorial will show how to push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…

691 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