Jump to content

[Question] - Problem with Task Scheduler


Loony BoB

Recommended Posts

I've recently reinstalled Windows on a new hard drive and have noticed that my Task Scheduler is no longer operating correctly. No matter how I set it up and no matter what I ask it to do - even if it's just opening Notepad - it won't run properly. What happens when the task is run is that, in Task Scheduler, it will display the word 'Running...' as normal, and if I open Task Manager the process will be there... but it's not running. I've tested everything I've run using the Start > Run command and I know that works just fine. Do you have any ideas on what might be causing this problem?

Just so you know, I've tried the fix used in this thread to no avail.

Link to comment
Share on other sites


Here's the info for one of my tasks.

Run: "C:\Documents and Settings\Daniel Towns\My Documents\Text files\landlord.txt"

Start in: "C:\Documents and Settings\Daniel Towns\My Documents\Text files"

Run as: COMPY-COMPY\Daniel Towns

Run only if logged in - unchecked.

Enabled - checked.

Schedule: I don't think this matters much as when I do a test run of anything (by right clicking the scheduled task and then clicking 'Run') it still won't run properly.

Settings

Delete the task if it is not scheduled to run again - unchecked.

Stop the task if it runs for 5 minutes - checked.

Idle time area - both unchecked.

Power Management area - First two options checked, last option unchecked.

The problem persists with these settings. Password has been checked twice.

Link to comment
Share on other sites

If the tasks aren't set to run interactively, you will not see them (and they may not work, if they need to interact with certain portions of the system).

Try adding the task using the "at" command (at <time in 24 hour format> <path to executable> /interactive) and see if the task runs.

Link to comment
Share on other sites

The thing is, I know these tasks worked before I got the new hard drive. I can't imagine any reason why they would work then and not now, unless it's some kind of weird configuration issue that is beyond my knowledge. :(

Also, I don't think there's any command such as that you mentioned which only activates on the first day of a month.

Link to comment
Share on other sites

No, but AT commands are good for testing if a Scheduled task is running correctly. An AT command will run as the logged-on user, if that user is logged on, and the /interactive switch ensures that it runs and can interact with winstation#0, or the console. Scheduled tasks should run like that when configured, but they don't always work properly (as you've now seen). It's at least a good test to see if the problem is with the scheduled tasks subsystem, or the OS itself.

Link to comment
Share on other sites

Ah, I see. I just ran the following using Start, 'Run':

at 1115 "C:\Documents and Settings\Daniel Towns\My Documents\Text files\landlord.txt" /interactive

When I entered the information, an MS DOS Prompt screen flashed for a splitsecond. When the time came around, nothing happened. I hope I did it right.

Link to comment
Share on other sites

Using the /integrate switch at the end causes it to be added as a parameter to the command.

Try this... (change time accordingly). If you use it in a cmd window you'll see "Added a new job with job ID = X"

at 11:15 /interactive /every: "C:\Documents and Settings\Daniel Towns\My Documents\Text files\landlord.txt"

Or this variant, to have it run on the 1st day of the month

at 11:15 /interactive /every:1 "C:\Documents and Settings\Daniel Towns\My Documents\Text files\landlord.txt"

C:\>at /?

The AT command schedules commands and programs to run on a computer at

a specified time and date. The Schedule service must be running to use

the AT command.

AT [\\computername][ [id] [/DELETE] | /DELETE [/YES]]

AT [\\computername] time [/iNTERACTIVE] [ /EVERY:date[,...] | /NEXT:date[,...]] "command"

\\computername Specifies a remote computer. Commands are scheduled on the

local computer if this parameter is omitted.

id Is an identification number assigned to a scheduled

command.

/delete Cancels a scheduled command. If id is omitted, all the

scheduled commands on the computer are canceled.

/yes Used with cancel all jobs command when no further

confirmation is desired.

time Specifies the time when command is to run.

/interactive Allows the job to interact with the desktop of the user

who is logged on at the time the job runs.

/every:date[,...] Runs the command on each specified day(s) of the week or

month. If date is omitted, the current day of the month

is assumed.

/next:date[,...] Runs the specified command on the next occurrence of the

day (for example, next Thursday). If date is omitted, the

current day of the month is assumed.

"command" Is the Windows NT command, or batch program to be run.

Link to comment
Share on other sites

Ah, this works! Thanks very much for your help.

Does anyone have any idea why this worked and Scheduled Tasks did not, despite Scheduled Tasks running before I formatted my PC?

EDIT: What would I need to enter next to /every to get a task to run every day?

Edited by Loony BoB
Link to comment
Share on other sites

Runs the command on each specified day(s) of the week or month

/every:monday means every monday ..:P

For everyday:

/every:monday,tuesday,wednesday,thursday,friday,saturday,sunday

Edited by nakira
Link to comment
Share on other sites

When you run a scheduled task as a specific user (rather than the local system account), you run the risk of the application not running properly in certain situations. For instance, if the script or program needs an actual user session and desktop heap memory, it will need to run interactively - that gives it a session, with the credentials of the user, and allows it to do things on the virtual winstation that it would not otherwise be able to do. If the program or script is unable to interact with the desktop winstation of the logged on user, it will show either as failing, or continue to run in an error state (and show "running") if it does not have error handling that can error out in such a situation (scripts being the most obvious in this scenario).

It is likely that you had the task set to run interactive in scheduled tasks before you formatted, and for whatever reason it isn't running interactively now.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...