Avatar of Jeff swicegood
Jeff swicegood
 asked on

Sheduled daily reboot in WIndows 7 only runs once

Hi,

I am trying to shedule a daily reboot on a WIndows 7 64bit machine.

I have setup my task in task manager. The PC reboots at the scheluled time the first time only, and then never reboots again. There is no message I can see about the task failing.

I created a file called reboot.bat  tha contians "shutdown /r" and then set it to run daily. When I run it manually through task manager it runs.

I have tried running taksmanager for setting up the task as both administrator and regular user. Seems to make no difference.
Microsoft Legacy OSWindows 7Windows OS

Avatar of undefined
Last Comment
Jeff swicegood

8/22/2022 - Mon
10023

Just a thought...is your system clock accurate??
Sumesh BNR

Have you selected 'One time only' when creating this task?
David Johnson, CD

In the triggers is is set to run daily?
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Sumesh BNR

check the run if logged on  option too (have you checked)
Jeff swicegood

ASKER
Yes, my trigger page looks exactly like the picture.
System Clock is Right
Run only when user logged on is checked
Jeff swicegood

ASKER
After the task executes and the computer reboots, the Next Run TIme field is blank.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
VB ITS

Is there a particular reason you created a batch file to perform the reboot command instead of just specifying the shutdown.exe command in the Actions tab?

In the Actions tab of your task, remove the existing entry for the batch file then click on New > select Start a program from the Action drop down > in the Program/script box type in shutdown.exe > in the Add arguments (optional) field type in -rOK > test the task again.
Jeff swicegood

ASKER
I tried it both ways. Same thing happens.

More info: When I first start the task sheduler I get the error: "Selected Task "(0)" not longer exists. To see the current task click Refresh".

When I hit refresh the errror pops up again.

Also when I click "Display all running tasks" I ger the error "Catastrophic Failure (Exception from HRESULT 0x8000FFFF (E_UNEXPECTED)
McKnife

Jeff, simply take the account "system" as executioner and all will be good.

My guess about the "why is this happening" (just a guess): you are on a domain. The default domain policy sets who has the privilege to run as a batch job (that is a user privilege required for scheduled tasks!). Whenever you setup that task, the account you chose was granted that privilege but after a reboot, a policy refresh occurs and overwrites that setting, rendering the task broken. Have seen that "problem" millions of times.

If that's not it, please look at the history tab of that task, that's like a log file.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
SOLUTION
VB ITS

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER CERTIFIED SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Jeff swicegood

ASKER
Surprisingly, setting system as the executor did not work. Here are the tests I have run.

PS C:\Windows\system32> sfc /scannow

Beginning system scan.  This process will take some time.

Beginning verification phase of system scan.
Verification 100% complete.

Windows Resource Protection did not find any integrity violations.

Open in new window


Output of tasks query
schtasks-query.txt

I did not run chkdsk yet, as I only have remote access late a night.

I did insert another task with your command line.
David Johnson, CD

Reboot                                   11/30/2014 2:03:02 PM  Ready
Reboot test                              Disabled



So we will know at 2PM tomorrow  (30 Nov)
McKnife

Some notes: your output file talks about insufficient access permissions - you did not execute it elevated, right? run cmd.exe elevated and un it again.
->sfc and checkdisk would not repair tasks. Task corruption as indicated by "catastrophic failure" can be undone by locating corrupt tasks, deleting their files and registry entries and recreating them.

Then: what about the history tab I mentioned, what does it say?
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Lionel MM

Folder: \MyTasks
TaskName                                 Next Run Time          Status
======================================== ====================== ===============
Reboot                                   11/30/2014 2:03:02 PM  Ready
Reboot test                              Disabled

Which one of these two tasks is the one that is failing and is one of these the one you added with SCHTASKS?
Jeff swicegood

ASKER
Yes I did run it with elevated privledges. Just to be sure I ran the query again as admin and the output is the same, with the messages about not having the access level.

@lionelmm Here are the pertinent part of the the updated schtasks query after adding your new task with SHCTASKS.

I forgot to change the task name so it remained "Name of Your Task"

Folder: \
TaskName                                 Next Run Time          Status
======================================== ====================== ===============
Name of your Task                 N/A                             Ready

Folder: \MyTasks
TaskName                                 Next Run Time          Status
======================================== ====================== ===============
Reboot                                   N/A                                 Ready
Reboot test                              Disabled

All these fail after completing once.

The history tab just shows that the tasks completed successfully.
VB ITS

Are you still receiving the "Selected Task "(0)" not longer exists" and "Catastrophic failure" error messages though?
Your help has saved me hundreds of hours of internet surfing.
fblack61
Jeff swicegood

ASKER
Yes. How do I track down which task(s) are corrupted?
Lionel MM

ok there seems to be something amiss here--it is not showing the run time--did it run the first time? Try this for me, where the user (/RU) is a domain admin
SCHTASKS /create /tn "Testing Reboot PC" /tr "c:\Windows\shutdown.exe -f -r -t 60" /sc daily /sd 11/29/2014 /st 17:00 /RU runasuser /RP userpassword
McKnife

Ok, if you ran the schtasks-command elevated, maybe there are tasks only accessible by the system account. Anyway, to find out what tasks are corrupted, you start task scheduler, open the task library and (hopefully) you will receive error messages. Because at that time all tasks are parsed, errors would be found and corrupted tasks would be named - normally.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Jeff swicegood

ASKER
@lionelmm:  This computer is not  part of a domain.

@McKnife: I receive no errors when opening the library.
McKnife

ok... but "Also when I click "Display all running tasks" I ger the error "Catastrophic Failure" persists?
Lionel MM

then use SCHTASKS /create /tn "Testing Reboot PC" /tr "c:\Windows\shutdown.exe -f -r -t 60" /sc daily /sd 11/29/2014 /st 17:00 /U runasuser /P userpassword
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Jeff swicegood

ASKER
I just followed a guide on how to remove all taks and registry keys for tasks and recreate them all. I left quite a few useless ones out. I recreated only the Microsoft ones. Now I get no Catastophic or  "Selected Task (0)" Errors.

Unfortunately, my reboot task will not even run manually through task scheduler now. I get err.txt
McKnife

Now try again with the system account.
Jeff swicegood

ASKER
Ok. Setting the user to "system" fixed that-- and it appears to be working! The next ron time field displays what it should. I will test it for a couple days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
VB ITS

Not sure why you had to set the user to SYSTEM to get it to run properly, I create Scheduled Tasks all the time to reboot servers and I've never had to set it to run as the SYSTEM account. At least it's working now though.

In the properties of the task, do you have the following options selected?
Run whether user is logged on or not
Tick Do not store password. The task will only have access to local computer resources.
Tick Run with highest privileges
Configure for: Windows 8.1
Lionel MM

Where are your scripts located? Where is this "\MyTasks\Reboot Task". I would expect to see C:\MyTasks\Reboot Task.bat so why is it only "\MyTasks\Reboot Task" for location of the script
Jeff swicegood

ASKER
I think what's lisited in query are names and folders strictly internal to task scheduler. I only had the one batch file in the root directory  and I got rid of it anyway in favor of your command line, and the approach therein.

@McKnife: FYI the culprits, corrupted tasks were two AVG Free Updaters. And it told me which ones were corrupt when I did schtasks /query /fo CSV > tasklist.csv.

@VB_ITS: Maybe something got messed up with it's credentials or memory of passwords. Although I never even set a password prior to this.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
VB ITS

See how you go with the task as it is. Are you able to confirm if the options in my previous post are selected/ticked?
Jeff swicegood

ASKER
Yes, they are tiked. Of course Run whether user is logged on or not is greyed out as well as Do not store password. The task will only have access to local computer resources.

Also this is Windows 7.

Run with highest privileges is tiked.
Jeff swicegood

ASKER
Thank you all  very much! It's working without a hitch.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.