Solved

Scheduled task not running on 2008 server

Posted on 2013-11-18
11
627 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
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
 
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
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

You might have come across a situation when you have Exchange 2013 server in two different sites (Production and DR). After adding the Database copy in ECP console it displays Database copy status unknown for the DR exchange server. Issue is strange…
This article will help you understand what HashTables are and how to use them in PowerShell.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

920 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

16 Experts available now in Live!

Get 1:1 Help Now