how to run a Scheduled Task when not loggged on

Discussion in 'Windows Server' started by childofthe1980s, Jul 5, 2009.

  1. Hello:

    I have successfully created a task in DOS to run in the Windows Server 2008
    Task Scheduler, using the DOS SCHTASKS command and syntax.

    The task runs successfully, but only if I as Administrator am logged in.

    If I am not logged in, the task does not run. Even if I go into Task
    Scheduler and tell the task to run at the scheduled time whether I am logged
    in or not, the task does not run.

    My guess is that once the task is created in DOS, you cannot edit it in the
    Task Scheduler without breaking it.

    Is there a syntax in DOS that will, upon creating the task, allow the task
    to run whether the user is logged in or not?

    childofthe1980s, Jul 5, 2009
    1. Advertisements

  2. How do you know that the task did not run? I suspect that it did and that it
    failed for some good reason. Let's have a look at what you're running! By
    the way, DOS is a legacy operating system introduced some 30 years ago. It
    is rarely used these days an is not available on a Win2008 Server. You're
    probably referring to the console command schtasks.exe.

    Here is an easy way to check if and when your tasks run. Create the
    following batch file, then run it under the Task Scheduler. The log file
    c:\test.log will tell you unambiguously what happened.
    @echo off
    echo %date% %time% %UserName% >> c:\test.log
    Pegasus [MVP], Jul 5, 2009
    1. Advertisements

  3. childofthe1980s

    Dave Patrick Guest

    Server Manager|Diagnostics|Event Viewer|Application
    Logs|Microsoft|Windows|TaskScheduler may provide some details. If the job
    connects to another machine you may need to add the user/ group 'logon as
    batch job' rights (server side). Control Panel|Admin Tools|Local Security
    Policy\Local Policies\User Rights Assignments
    "Log on as a batch job"

    If the task completes but the job does not then there is a problem in the
    job itself. Remember that if it involves network resources to make sure the
    user account has permissions to the resources and also use UNC paths as
    mapped drives won't natively exist when no one is logged on.



    Dave Patrick ....Please no email replies - reply in newsgroup.
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Dave Patrick, Jul 5, 2009
  4. childofthe1980s

    Marcin Guest

    Use AT command scheduler - but keep in mind that it runs in the security
    context of the Local System account...

    Marcin, Jul 5, 2009
  5. Using at.exe instead of the inbuilt Task Scheduler is not only walking
    around the problem (instead of solving it) but it is also equivalent to
    using a push bike instead of a car because the car engine won't start.
    Furthermore the OP's problem is likely to be caused by network access
    issues. They can be resolved with the inbuilt Task Scheduler but they can't
    with at.exe, for the very reason you spelt out in your reply.
    Pegasus [MVP], Jul 5, 2009
  6. I know that it did not run because it is designed to place a report into a
    folder, like it does when I manually run the task. That report is NOT there!

    I have to use DOS, because Microsoft support told me that it is the only way
    to add a task in Task Scheduler.

    childofthe1980s, Jul 5, 2009
  7. But, I'm using the Administrator account.

    childofthe1980s, Jul 5, 2009
  8. Umm.....I don't know, Pegasus. I'm willing to try anything. If you'll read
    my reply to what you said earlier, you will understand why.

    Onto googling "AT Scheduler". Thanks, Marcin!

    childofthe1980s, Jul 5, 2009
  9. Thanks, Marcin! Don't worry about Pegasus's reply. You gave me a good idea.

    childofthe1980s, Jul 5, 2009
  10. Just because your report is not in the folder where you expect it does NOT
    mean that the task did not run. The task might have run but it could have
    failed halfway through the job. As Dave Patrick suggested, this often
    happens when you attempt to access networked resources, e.g. a drive that is
    mapped in the foreground but is invisible in the background where the
    scheduled job runs. Using at.exe as suggested by Marcin will not solve this
    type of problem.

    It appears you missed the point about DOS. The black screen you see when you
    run cmd.exe is called the "Console". Most operating systems have a console
    mode. Calling them "DOS" because they're black is about the same as calling
    a BMW a cart because both have four wheels.
    Pegasus [MVP], Jul 5, 2009
  11. nope

    I'll just have to wait until tomorrow when I can re-connet with the
    Microsoft engineer who is also struggling with this.
    childofthe1980s, Jul 5, 2009
  12. In the meantime you might try the batch file I suggested in my first reply.
    You might also check the Task Scheduler log file. You can see it in the Task
    Scheduler screen under the Advanced pull-down menu.
    Pegasus [MVP], Jul 5, 2009
  13. childofthe1980s

    Dave Patrick Guest

    That makes no difference.



    Dave Patrick ....Please no email replies - reply in newsgroup.
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Dave Patrick, Jul 5, 2009
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.