Windows Server 2012 - Task Scheduler Issue
-
@Pete-S said in Windows Server 2012 - Task Scheduler Issue:
@Obsolesce said in Windows Server 2012 - Task Scheduler Issue:
@Pete-S said in Windows Server 2012 - Task Scheduler Issue:
@anthonyh said in Windows Server 2012 - Task Scheduler Issue:
@anthonyh said in Windows Server 2012 - Task Scheduler Issue:
@Pete-S said in Windows Server 2012 - Task Scheduler Issue:
@anthonyh said in Windows Server 2012 - Task Scheduler Issue:
@Pete-S said in Windows Server 2012 - Task Scheduler Issue:
@anthonyh said in Windows Server 2012 - Task Scheduler Issue:
I am having an interesting problem with the Windows Task Scheduler under Server 2012. I have a couple dozen scheduled tasks that do various things via PowerShell scripts (mostly pull data from a SQL database then ship it off to their respective recipient). These scripts have been in place and scheduled for years. However, recently, about a half dozen of the scheduled tasks have plain stopped triggering and I have no idea why.
For example, I have a scheduled task that's set to run at 9PM every Monday, Tuesday, Wednesday, Thursday, Friday of every week. It's "Next Run Time" is tonight at 9PM. It's "Last Run Time" was 1/24/2020 at 9:01:20 PM. Whaa?? The "Last Run Result" was "The operation completed successfully. (0x0)".
I can right click the offending jobs and run them manually no problem. I've "poked" at the scheduled tasks, enabled/disabled them, the trigger, changed the time back/forth, even changed the "Configure for" option from the default "Windows Vista, Windows Server 2008" to "Windows Server 2012". One thing I have not tried exporting/importing the offending tasks.
I'm curious if any of y'all have experienced anything like this?
If the task doesn't complete, it will not run again. Also the task scheduling service have to be running for any tasks to be triggered.
Right. I have "Stop the task if it runs longer than" set to 3 days. So I should see them in the "Running" state if that were the case, no?
Depends on if they are running right now. Anyway, how long does the task take to complete? Do your scripts produce a log file?
They are all "Ready" as of this moment. They run nightly, so I should see them as "Running" right now.
Some of them do, some of them do not (I've been adding Start/Stop Transcript to them as I've needed to troubleshoot). For those that do log, the log's last modified date/time corresponds to the last time the Task Scheduler reports the task ran.
I just edited my original post to add that the script I talk about as an example does log, and the log has not been touched since Task Scheduler reported it ran successfully.
OK, post screenshot of each tab under that task's properties, including what's under the edit button on the "triggers" tab.
Just export the xml here, clean any sensitive info. Easier.
Except that it is not really in clear text. Or do you what user "S-1-5-18" is?
Ya that's a well-known id
-
What does the task history look like?
-
@Pete-S said in Windows Server 2012 - Task Scheduler Issue:
What does the task history look like?
Looks empty.
-
@anthonyh said in Windows Server 2012 - Task Scheduler Issue:
@Obsolesce said in Windows Server 2012 - Task Scheduler Issue:
@Pete-S said in Windows Server 2012 - Task Scheduler Issue:
@anthonyh said in Windows Server 2012 - Task Scheduler Issue:
@anthonyh said in Windows Server 2012 - Task Scheduler Issue:
@Pete-S said in Windows Server 2012 - Task Scheduler Issue:
@anthonyh said in Windows Server 2012 - Task Scheduler Issue:
@Pete-S said in Windows Server 2012 - Task Scheduler Issue:
@anthonyh said in Windows Server 2012 - Task Scheduler Issue:
I am having an interesting problem with the Windows Task Scheduler under Server 2012. I have a couple dozen scheduled tasks that do various things via PowerShell scripts (mostly pull data from a SQL database then ship it off to their respective recipient). These scripts have been in place and scheduled for years. However, recently, about a half dozen of the scheduled tasks have plain stopped triggering and I have no idea why.
For example, I have a scheduled task that's set to run at 9PM every Monday, Tuesday, Wednesday, Thursday, Friday of every week. It's "Next Run Time" is tonight at 9PM. It's "Last Run Time" was 1/24/2020 at 9:01:20 PM. Whaa?? The "Last Run Result" was "The operation completed successfully. (0x0)".
I can right click the offending jobs and run them manually no problem. I've "poked" at the scheduled tasks, enabled/disabled them, the trigger, changed the time back/forth, even changed the "Configure for" option from the default "Windows Vista, Windows Server 2008" to "Windows Server 2012". One thing I have not tried exporting/importing the offending tasks.
I'm curious if any of y'all have experienced anything like this?
If the task doesn't complete, it will not run again. Also the task scheduling service have to be running for any tasks to be triggered.
Right. I have "Stop the task if it runs longer than" set to 3 days. So I should see them in the "Running" state if that were the case, no?
Depends on if they are running right now. Anyway, how long does the task take to complete? Do your scripts produce a log file?
They are all "Ready" as of this moment. They run nightly, so I should see them as "Running" right now.
Some of them do, some of them do not (I've been adding Start/Stop Transcript to them as I've needed to troubleshoot). For those that do log, the log's last modified date/time corresponds to the last time the Task Scheduler reports the task ran.
I just edited my original post to add that the script I talk about as an example does log, and the log has not been touched since Task Scheduler reported it ran successfully.
OK, post screenshot of each tab under that task's properties, including what's under the edit button on the "triggers" tab.
Just export the xml here, clean any sensitive info. Easier.
Here is the XML of the task I mentioned in my OP. I can do screenshots too if that's still desired by anyone.
<?xml version="1.0" encoding="UTF-16"?> <Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> <RegistrationInfo> <Date>2015-12-23T13:40:10.4492565</Date> <Author>[REDACTED]</Author> </RegistrationInfo> <Triggers> <CalendarTrigger> <StartBoundary>2015-12-23T21:00:00</StartBoundary> <Enabled>true</Enabled> <ScheduleByWeek> <DaysOfWeek> <Monday /> <Tuesday /> <Wednesday /> <Thursday /> <Friday /> </DaysOfWeek> <WeeksInterval>1</WeeksInterval> </ScheduleByWeek> </CalendarTrigger> </Triggers> <Principals> <Principal id="Author"> <UserId>S-1-5-18</UserId> <RunLevel>LeastPrivilege</RunLevel> </Principal> </Principals> <Settings> <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy> <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries> <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries> <AllowHardTerminate>true</AllowHardTerminate> <StartWhenAvailable>false</StartWhenAvailable> <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable> <IdleSettings> <StopOnIdleEnd>true</StopOnIdleEnd> <RestartOnIdle>false</RestartOnIdle> </IdleSettings> <AllowStartOnDemand>true</AllowStartOnDemand> <Enabled>true</Enabled> <Hidden>false</Hidden> <RunOnlyIfIdle>false</RunOnlyIfIdle> <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession> <UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine> <WakeToRun>false</WakeToRun> <ExecutionTimeLimit>P3D</ExecutionTimeLimit> <Priority>7</Priority> </Settings> <Actions Context="Author"> <Exec> <Command>powershell</Command> <Arguments>-ExecutionPolicy Bypass -File "C:\scripts[REDACTED].ps1"</Arguments> </Exec> </Actions> </Task>
Does it run if you right-click on the task and run it manually?
-
@Obsolesce said in Windows Server 2012 - Task Scheduler Issue:
@anthonyh said in Windows Server 2012 - Task Scheduler Issue:
@Obsolesce said in Windows Server 2012 - Task Scheduler Issue:
@Pete-S said in Windows Server 2012 - Task Scheduler Issue:
@anthonyh said in Windows Server 2012 - Task Scheduler Issue:
@anthonyh said in Windows Server 2012 - Task Scheduler Issue:
@Pete-S said in Windows Server 2012 - Task Scheduler Issue:
@anthonyh said in Windows Server 2012 - Task Scheduler Issue:
@Pete-S said in Windows Server 2012 - Task Scheduler Issue:
@anthonyh said in Windows Server 2012 - Task Scheduler Issue:
I am having an interesting problem with the Windows Task Scheduler under Server 2012. I have a couple dozen scheduled tasks that do various things via PowerShell scripts (mostly pull data from a SQL database then ship it off to their respective recipient). These scripts have been in place and scheduled for years. However, recently, about a half dozen of the scheduled tasks have plain stopped triggering and I have no idea why.
For example, I have a scheduled task that's set to run at 9PM every Monday, Tuesday, Wednesday, Thursday, Friday of every week. It's "Next Run Time" is tonight at 9PM. It's "Last Run Time" was 1/24/2020 at 9:01:20 PM. Whaa?? The "Last Run Result" was "The operation completed successfully. (0x0)".
I can right click the offending jobs and run them manually no problem. I've "poked" at the scheduled tasks, enabled/disabled them, the trigger, changed the time back/forth, even changed the "Configure for" option from the default "Windows Vista, Windows Server 2008" to "Windows Server 2012". One thing I have not tried exporting/importing the offending tasks.
I'm curious if any of y'all have experienced anything like this?
If the task doesn't complete, it will not run again. Also the task scheduling service have to be running for any tasks to be triggered.
Right. I have "Stop the task if it runs longer than" set to 3 days. So I should see them in the "Running" state if that were the case, no?
Depends on if they are running right now. Anyway, how long does the task take to complete? Do your scripts produce a log file?
They are all "Ready" as of this moment. They run nightly, so I should see them as "Running" right now.
Some of them do, some of them do not (I've been adding Start/Stop Transcript to them as I've needed to troubleshoot). For those that do log, the log's last modified date/time corresponds to the last time the Task Scheduler reports the task ran.
I just edited my original post to add that the script I talk about as an example does log, and the log has not been touched since Task Scheduler reported it ran successfully.
OK, post screenshot of each tab under that task's properties, including what's under the edit button on the "triggers" tab.
Just export the xml here, clean any sensitive info. Easier.
Here is the XML of the task I mentioned in my OP. I can do screenshots too if that's still desired by anyone.
<?xml version="1.0" encoding="UTF-16"?> <Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> <RegistrationInfo> <Date>2015-12-23T13:40:10.4492565</Date> <Author>[REDACTED]</Author> </RegistrationInfo> <Triggers> <CalendarTrigger> <StartBoundary>2015-12-23T21:00:00</StartBoundary> <Enabled>true</Enabled> <ScheduleByWeek> <DaysOfWeek> <Monday /> <Tuesday /> <Wednesday /> <Thursday /> <Friday /> </DaysOfWeek> <WeeksInterval>1</WeeksInterval> </ScheduleByWeek> </CalendarTrigger> </Triggers> <Principals> <Principal id="Author"> <UserId>S-1-5-18</UserId> <RunLevel>LeastPrivilege</RunLevel> </Principal> </Principals> <Settings> <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy> <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries> <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries> <AllowHardTerminate>true</AllowHardTerminate> <StartWhenAvailable>false</StartWhenAvailable> <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable> <IdleSettings> <StopOnIdleEnd>true</StopOnIdleEnd> <RestartOnIdle>false</RestartOnIdle> </IdleSettings> <AllowStartOnDemand>true</AllowStartOnDemand> <Enabled>true</Enabled> <Hidden>false</Hidden> <RunOnlyIfIdle>false</RunOnlyIfIdle> <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession> <UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine> <WakeToRun>false</WakeToRun> <ExecutionTimeLimit>P3D</ExecutionTimeLimit> <Priority>7</Priority> </Settings> <Actions Context="Author"> <Exec> <Command>powershell</Command> <Arguments>-ExecutionPolicy Bypass -File "C:\scripts[REDACTED].ps1"</Arguments> </Exec> </Actions> </Task>
Does it run if you right-click on the task and run it manually?
As per my OP:
"I can right click the offending jobs and run them manually no problem. "
-
Has this only happened once?
-
@Pete-S said in Windows Server 2012 - Task Scheduler Issue:
Has this only happened once?
Nope. It's been happening for at least a week or so. I've finally pulled a majority of my hair out and made a post here.
-
Is the system fully up to date as much as it can be?
-
@Obsolesce said in Windows Server 2012 - Task Scheduler Issue:
Is the system fully up to date as much as it can be?
Yep! That's actually what the reboot was for last Thursday. Windowwwwwws updatesssssss.
The problem has been happening before that, unfortunately.
-
Well, create a new task with the same settings and see if that gives the same issue.
-
@anthonyh said in Windows Server 2012 - Task Scheduler Issue:
@Pete-S said in Windows Server 2012 - Task Scheduler Issue:
Has this only happened once?
Nope. It's been happening for at least a week or so. I've finally pulled a majority of my hair out and made a post here.
There is always the possibility that it is the task scheduling service that fails or one of it's dependencies.
You could create a new task that triggers a simple script that just writes the current time in a log file.
If the task service fails to run you would know and also be able to see when.There are some settings under the service as well what the service should do if it fails. Might want to check those as well.
-
What's killing me is this only impacts some tasks. Other tasks that run as the SYSTEM account that do similar functions (execute a PowerShell script that does a SQL query and ships the result to its respective destination) are fine.
I don't know how the underlyings of the Task Scheduler work, but a WAG says that something on the back end is corrupt/broken. I dunno if there is a "rebuild" Task Scheduler sort of function.
-
@Obsolesce said in Windows Server 2012 - Task Scheduler Issue:
Well, create a new task with the same settings and see if that gives the same issue.
Yeah, I think I may just do that. Though I'd really like to know 1) what happened (?!?!), and 2) if there is a better fix than to just re-do things, heh.
-
How many tasks are we talking about?
I would probably export them, delete and import just to be certain.
And make sure task history is enabled.
-
@Pete-S said in Windows Server 2012 - Task Scheduler Issue:
@anthonyh said in Windows Server 2012 - Task Scheduler Issue:
@Pete-S said in Windows Server 2012 - Task Scheduler Issue:
Has this only happened once?
Nope. It's been happening for at least a week or so. I've finally pulled a majority of my hair out and made a post here.
There is always the possibility that it is the task scheduling service that fails or one of it's dependencies.
You could create a new task that triggers a simple script that just writes the current time in a log file.
If the task service fails to run you would know and also be able to see when.There are some settings under the service as well what the service should do if it fails. Might want to check those as well.
If the Task Scheduler service was failing, wouldn't that be written to the Event Log? If so, it's not.
-
@anthonyh said in Windows Server 2012 - Task Scheduler Issue:
@Obsolesce said in Windows Server 2012 - Task Scheduler Issue:
Well, create a new task with the same settings and see if that gives the same issue.
Yeah, I think I may just do that. Though I'd really like to know 1) what happened (?!?!), and 2) if there is a better fix than to just re-do things, heh.
Well, you could add into the script at the end, to remove the scheduled task and create it again, followed by a verification of such, and to email you if it fails.
-
@anthonyh said in Windows Server 2012 - Task Scheduler Issue:
@Pete-S said in Windows Server 2012 - Task Scheduler Issue:
@anthonyh said in Windows Server 2012 - Task Scheduler Issue:
@Pete-S said in Windows Server 2012 - Task Scheduler Issue:
Has this only happened once?
Nope. It's been happening for at least a week or so. I've finally pulled a majority of my hair out and made a post here.
There is always the possibility that it is the task scheduling service that fails or one of it's dependencies.
You could create a new task that triggers a simple script that just writes the current time in a log file.
If the task service fails to run you would know and also be able to see when.There are some settings under the service as well what the service should do if it fails. Might want to check those as well.
If the Task Scheduler service was failing, wouldn't that be written to the Event Log? If so, it's not.
Well, we are kind of assuming that we are dealing with something that has changed or is not the way it should. Either a software bug, a change made by windows updates, insufficient privileges or something of that nature.
-
@Pete-S said in Windows Server 2012 - Task Scheduler Issue:
How many tasks are we talking about?
I would probably export them, delete and import just to be certain.
And make sure task history is enabled.
Looks like at least 4 tasks are having this issue (there may be some more, I need to do another pass through the scheduled tasks). I'm going to try an export/delete/import and see what happens...
-
@anthonyh said in Windows Server 2012 - Task Scheduler Issue:
@Pete-S said in Windows Server 2012 - Task Scheduler Issue:
How many tasks are we talking about?
I would probably export them, delete and import just to be certain.
And make sure task history is enabled.
Looks like at least 4 tasks are having this issue (there may be some more, I need to do another pass through the scheduled tasks). I'm going to try an export/delete/import and see what happens...
Don't import the old task. Create it new. Just set the same options, but new start date.
-
Wow, so I just went through all the scheduled tasks on this box.
There are 41 tasks total. Out of the 41, there are 13 that are in this weird "ignored" condition. Bleh. This is going to be fun re-creating these.