View Full Version : Auto-delete old temp files: Task Scheduler won't run
Sylvander
11-02-2008, 04:14 AM
1. Went HERE (http://lifehacker.com/photogallery/Top-10-Ways-to-Clean-Up-Your-PC/2465179), then HERE (http://lifehacker.com/software/lifehacker-code/clean-out-old-files-with-the-windows-janitor-script-288443.php), downloaded the Janitor VBS Script, copied the text into a txt file renamed to vbs and saved.
2. Edited the pathToClean ["C:\Documents and Settings\(username)\Local Settings\temp"] and numberOfDays [7] variables inside the script file and saved the changes.
I can "Open" that script and it seems to work OK.
Set to delete all files 7 days old and more within the above folder.
3. Went to "Control Panel->Scheduled Tasks" and scheduled a new task, but Windows reports "Task Scheduler service is not running".
4. In Services.msc the "Task Scheduler" is set to "Automatic", but isn't running.
5. How do I get this to work?
Paul Komski
11-03-2008, 02:28 AM
You should be able to restart it manually (http://www.tomshardware.com/forum/103520-45-task-scheduler-service-running) but perhaps none of your tasks are yet enabled. A reboot could also help maybe and indeed I have also read "The Event Log Service has to be running to be able to start the Task Scheduler Service".
If you are not logged on as an admin with a password then try setting a password, even if you then use autologon.
Sylvander
11-03-2008, 05:15 AM
1. "perhaps none of your tasks are yet enabled"
I had deleted the task, so I just now recreated it, and it seems enabled.
When I click to view the properties of the task the following warning is displayed:
General page initialization failed.
The specific error is:
0x80041315: The Task Scheduler Service is not running.
2. "You should be able to restart it manually"
In Services.msc "Task Scheduler" is set to "Automatic", but is not running, and the only action available in the right-click menu for that item is "Start".
When I click Start, the following warning is displayed:
Could not start the Task Scheduler service on Local Computer.
Error 1083: The executable program that this service is configured to run in does not implement the service.
3. ""The Event Log Service has to be running to be able to start the Task Scheduler Service""
The Event Log Service is set to "Automatic" and is "Started".
4. "If you are not logged on as an admin with a password then try setting a password"
This ADMIN user account has a username and password set, but the need to enter a password at login is disabled, so at Startup all I see is a quick flash of the login window with username and password already set.
I set that correct ADMIN password for the task when setting the task.
In the "Scheduled Task->Properties->Task" tab the "Enabled" box is ticked.
In the "Schedule" tab the time is set, and to run daily from today.
The task has just failed a couple of times to run at times I set.
If it had tried to run I'd hear the "Open Program" and "Close Program" event sounds, but I hear nothing, and see no other signs.
Paul Komski
11-03-2008, 05:33 AM
Does this happen as soon as you try to add the task or only after the wizard completes. If the latter it could possibly be that scripts are being blocked. Try starting something like a simple executable such as notepad on a schedule.
Below is a harmless vbs that you could just try running from your desktop or wherever to see if scripting generally is blocked. Just save the text file as with a .vbs extension.
if msgbox ("You may be pregnant" ,vbOKCancel+vbCritical,"First Message") = vbOK then
msgbox "Congratulations", vbExclamation , "Secondary Message"
else
msgbox "No so easy to cancel a pregnancy", vbInformation , "Secondary Message"
end if
PS
Which OS and which SP? You may apparently need SP4 for Win2K.
Sylvander
11-03-2008, 06:36 AM
1. "Which OS and which SP?"
Win2000Pro SP4.
2. "Does this happen as soon as you try to add the task"
When adding the new task you gave, and the work in the wizard has been completed and I click "Finish"...
Possibly because I tried changing the account info from PCname/username to username alone [then tried it the original way too, didn't make any difference]...
Then the warning variation on the previous warning 1 was displayed as follows:
The new task has been created, but may not run because the account information could not be set.
The specific error is:
0x80041315: The Task Scheduler Service is not running.
When I clicked OK, a new warning was displayed identical to previous warning 1.
It appears this new task doesn't run either. :(
It runs fine if I do it manually.
Paul Komski
11-03-2008, 07:08 AM
Maybe try logging on as a different user or go back to an earlier image or else run a repair installation which is what gets posted most commonly as a fix relating to this message with respect to a number of services and not just the task scheduler.
Sylvander
11-03-2008, 08:51 AM
Found these:
General page initialization failed.
The specific error is:
0x80041315: The task scheduler service is not running. (http://support.microsoft.com/kb/223170)
The new task has been created, but may not run because the account information could not be set.
The specific error is:
0x80041315: The task scheduler service is not running. (http://support.microsoft.com/kb/250039)
And this:
Error 1083: The executable program that this service is configured to run in does not implement the service. (http://support.microsoft.com/kb/910337)
I'll begin reading these and follow any instructions to see if they produce a fix.
I don't think restoring an image is going to help here because this is pretty certainly something that didn't happen recently, but way back.
I'm really reluctant to attempt a repair because I'd need to streamline the latest service pack[s].
Hardly worth it for a small inconvenience like this.
After editing a setting in the registry and a couple of other instructed alterations:
Winpatrol has just informed me that Task Scheduler has been set to run at Startup [added to the Startup list], so I think I'll try restarting.
Sylvander
11-03-2008, 09:16 AM
After Restart:
Services.msc now shows "Task Scheduler" "Started". :)
Both the test.vbs and janitor.vbs are running automatically as scheduled.
Winpatrol has just informed me that both these tasks are now on the Startup list.
Is that as it should be? :confused:
So far as I'm aware they are not configured to run at Startup.
Ran "Control Panel->Startup" and none of these are in any Startup location inside the registry or out.
Perhaps they were put in the "RunOnce" key in the registry [and then deleted as they should be]?
Sylvander
11-06-2008, 05:18 AM
Hey, this arrangement really works! :)
The temporary files in that folder...
C:\Documents and Settings\(username)\Local Settings\temp
Are being kept to only a small list of those that are less than 2 days old. :D :cool:
I think they are considered only one day old if they are [more than 24 hours and] less than 48 hours old.
So they must be greater than 48 hours old to be deleted I think.
Figure that. :confused:
Fred_Flintstone
11-06-2008, 05:31 AM
I think they are considered only one day old if they are [more than 24 hours and] less than 48 hours old.
So they must be greater than 48 hours old to be deleted I think.
Figure that. :confused:
Logically speaking.. I suppose if they are anything less than 48hrs..they ARE less than 2 days old??..
Paul Komski
11-06-2008, 05:32 AM
Was that the first restart or the first restart after editing the registry?
What did you edit in the registry? Would be useful info.
Sylvander
11-06-2008, 05:55 AM
1. "Was that the first restart or the first restart after editing the registry?"
I think I know that you think you know what you think you said...
But... [he, he];)
Actually there have been MANY restarts since then.
I believe it worked after the 1st restart. :)
[After Winpatrol reported that the Task Scheduler had been added to a Startup list setting in the registry]
[Which was probably an immediate consequence of the various changes I make, primarily the edit of the registry]
2. "What did you edit in the registry? Would be useful info."
(a) The 2nd link I gave [to this page (http://support.microsoft.com/kb/250039)] was the one that gave the registry edit instructions.
i.e.
2. Locate the ImagePath value under the following key in the registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\Schedule
3. Double-click the ImagePath value.
4. Change the path to:
%SystemRoot%\System32\Mstask.exe
Before i made the change I checked that Mstask.exe actually existed, and was in that location.
(b) I definitely used also the 3rd link [this one (http://support.microsoft.com/kb/910337)] and carried out the instructions there...
Particularly this one that applied:
Error 1083: The executable program that this service is configured to run in does not implement the service. (0x8007043B)
If you receive this error message, follow these steps:
1. Click Start, click Run, type Regsvr32 %windir%\system32\qmgr.dll, and then click OK.
2. Click Start, click Run, type regsvr32 %windir%\system32\qmgrprxy.dll, and then click OK.
3. Click Start, click Run, type services.msc, and then click OK.
4. Double-click Background Intelligent Transfer Service.
5. In the General tab, click Start.
Sylvander
11-06-2008, 06:03 AM
"Logically speaking.. I suppose if they are anything less than 48hrs..they ARE less than 2 days old??"
Hmmm, it's easy once you get it, but it looked strange at 1st glance.
I always fancied the idea of being formally trained in HOW TO THINK LOGICALLY.
Now and then I become aware that I don't really know how to do that well...
Even though Mathematics was a favourite subject of mine [not that I was great at it, but my daughter was REALLY ELEGANT with her proofs (and her writing was really beautiful), and my son is now a Physics teacher].
Fred_Flintstone
11-06-2008, 06:26 AM
Hmmm, it's easy once you get it, but it looked strange at 1st glance.
I wasn't being sarcastic with that comment!!... had to read it a couple of times myself!..:)
Then, when it "hits you" 24 hours 1 second is "more than a day old"..
47 hour 59 seconds is "less than 2 days old"...
I always fancied the idea of being formally trained in HOW TO THINK LOGICALLY.
Don't we all.. I wish I was like that too..
Even though Mathematics was a favourite subject of mine [not that I was great at it
I can remember being physically beaten in school because I couldn't grasp the concept of:
"The square on the hypotenuse is equal to the sum of the squares on the other two sides"!!!...:confused:
I just could NOT see where the "squares" were in the triangle!!...:cool:
The teacher thought I was taking the p**s and knocked the cr** out of me..
I was about 13 yrs old at the time!!...:rolleyes:
Like to see him get away with THAT these days!!...:D :D :D
Sylvander
11-06-2008, 09:06 AM
I remember one time coming in to class late...
And the teacher had just began teaching Algebra...
I thought I'd entered the twilight zone.
Suddenly nothing that was being said made any sense.
Addition, subtraction, multiplication, division of LETTERS OF THE ALPHABET!!!!!!
what do you get if you add 2 letter X's to 3 letter Y's?!?!???!!!!
Bit of a shock to my young brain. :confused:
Sylvander
11-06-2008, 10:50 AM
Made another copy of the VBS file...
Named the original janitor1.vbs and the new copy janitor2.vbs...
Saved both files in a new location in their own folder D:\00tmp\VBS.
This partition has images AND SyncBack backups made of it, so it's well insured.
Made janitor2.vbs delete all files older than 2 days in folder
C:\Documents and Settings\[username]\Recent
Changed the Scheduled Tasks to suit.
I like the fact I can build this 1 bit at a time and see the effect. :cool:
Can the saving of shortcuts in the recent folder be configured?
vBulletin v3.6.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.