Task scheduler - Windows 2019 - Indefinitly task not running

Eric C 126 Reputation points
2021-03-12T09:58:50.41+00:00

Hi,

This is not a qestion, this is an answer ! I hope it could help because I spent hours.

On Windows server 2019, if you have a task to repeat let say every 5 minutes indefinitly, You have to trigger it this way :

  • On a schedule
  • One time
  • Advanced settings / repeat tasks every xxx minutes for a duration Indefinitly.

or

  • On a schedule
  • Daily
  • Advanced settings / repeat tasks every xxx minutes for a duration 1 Day.

On Windows server 2012, 2008, I used to select "Daily" instead of "One time" for an indefintly period, but if you do so in Windows 2019 Task scheduler, the task will never run, when the time is come it just schedule the next time without running any program.

It sounds finally logic but you have no information about why the task is not running (and there is not entry log in the task scheduler history), and the next run time is however exact, but nothing happens

Regards,

Eric

Windows Server 2019
Windows Server 2019
A Microsoft server operating system that supports enterprise-level management updated to data storage.
3,470 questions
{count} votes

14 answers

Sort by: Most helpful
  1. Russ 5 Reputation points
    2023-10-19T13:36:54.7033333+00:00

    I got mine fixed by changing from indefinitely to 1 day

    User's image

    1 person found this answer helpful.
    0 comments No comments

  2. Eric C 126 Reputation points
    2021-03-30T07:45:53.64+00:00

    Unfortunatly no other windows server 2019.

    Best regards,

    Eric

    0 comments No comments

  3. Mullins, Michael E 1 Reputation point
    2021-06-09T17:42:20.81+00:00

    I have the same problem with the Task Scheduler on a Windows 2019 Server. I found if I selected Indefinitely the task will not run. Once I selected Weekly and everyday of Day of the week and set the duration to 365 days the task Started to function Correctly. I am going to experiment with going back to Daily and set the time to every 5 min and try different of day's by year ie.. 365, 730,....

    0 comments No comments

  4. Amir Fard 1 Reputation point
    2022-02-22T01:17:07.417+00:00

    For me it doesn't work on Windows 2019.
    The user has run batch file privilege and all, but it won't work as above. If I add this in the beginning of the batch file, it works flawlessly:
    Source

    ::::::::::::::::::::::::::::::::::::::::::::
    
    :: Automatically check & get admin rights V2
    ::::::::::::::::::::::::::::::::::::::::::::
    @echo off
    CLS
    ECHO.
    ECHO =============================
    ECHO Running Admin shell
    ECHO =============================
    
    :init
    setlocal DisableDelayedExpansion
    set "batchPath=%~0"
    for %%k in (%0) do set batchName=%%~nk
    set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
    setlocal EnableDelayedExpansion
    
    :checkPrivileges
    NET FILE 1>NUL 2>NUL
    if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
    
    :getPrivileges
    if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
    ECHO.
    ECHO **************************************
    ECHO Invoking UAC for Privilege Escalation
    ECHO **************************************
    
    ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
    ECHO args = "ELEV " >> "%vbsGetPrivileges%"
    ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
    ECHO args = args ^& strArg ^& " "  >> "%vbsGetPrivileges%"
    ECHO Next >> "%vbsGetPrivileges%"
    ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
    "%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
    exit /B
    
    :gotPrivileges
    setlocal & pushd .
    cd /d %~dp0
    if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul  &  shift /1)
    
    ::::::::::::::::::::::::::::
    ::START
    
    
    
    YOUR COMMANDS START HERE
    
    0 comments No comments

  5. FOLORUNSHO David 1 Reputation point
    2022-07-15T18:03:13.873+00:00

    You are a life saver. This just saved me hours of troubleshooting.

    0 comments No comments