Scheduled task "run as" question

Discussion in 'Windows Server' started by pbrill1, Jun 15, 2006.

  1. pbrill1

    pbrill1 Guest

    I am trying to execute a .bat script under Scheduled Events to run on a W2K3
    server at scheduled times...when no one is logged onto the server. The batch
    script executes a 'net stop' service command at say 8PM, and a 'net start'
    batch script at 5AM. When I've set up the scheduled task, the script will
    run when the TASK TAB is set to RUN AS: <DOMAIN>\ADMINISTRATOR and the
    SECURITY TAB includes SYSTEM and this ADMINISTRATOR with Full Control rights.
    Trouble is, it seems that you need to be logged on as administrator at the
    server to execute these batch scripts (they don't run when I am logged off of
    the server. Are there some setting changes that I can make to execute these
    batch scripts from a W2K3 server...without requiring me to remain logged on
    as administrator all night?
    pbrill1, Jun 15, 2006
    1. Advertisements

  2. Untick the box "Run only if logged on" under the Task tab.
    Pegasus \(MVP\), Jun 15, 2006
    1. Advertisements

  3. pbrill1

    pbrill1 Guest

    Thanks - your info is correct, a typo that I made in the original message
    made my original question inaccurate.

    The server that I am attempting to execute the batch files on is a W2K
    server...not a W2K3. While "Run only if logged on" is a choice in the W2K3
    server scheduled tasks... it doesn't appear as a choice on a W2K server.

    Is there any way to force this option in Scheduled Tasks for a W2K server
    that we cannot perform an OS upgrade on for another 6-9 mo.?
    pbrill1, Jun 23, 2006
  4. My Win2000 servers run scheduled tasks regardless of who
    is logged on - even when nobody is logged on. I suspect yours
    do the same too. Start your tests by scheduling the following
    batch file, then examine the log file c:\log.txt.

    @echo off
    echo %date% %time% %Username% >> c:\log.txt

    If you wish to continue this discussion then please do not
    wait 8 days with a reply. It is a waste of my time having
    to re-read the whole thread each time, after such a long
    Pegasus \(MVP\), Jun 23, 2006
  5. pbrill1

    pbrill1 Guest

    It's now 6.30.06 - I have been trying to get the batch scripts running each
    night, but now am receiving 0xffffffff errors.

    I've tried using the c:\log.txt script that Pegasus provided, and I DO get

    Mon 06/26/2006 21:40:00.37 administrator
    Tue 06/27/2006 21:40:01.02 administrator
    Wed 06/28/2006 21:40:00.40 administrator
    Thu 06/29/2006 21:40:00.58 administrator

    Although the script never runs. These batch scripts DID run fine a few
    weeks ago, and the scripts have not been modified.

    I've attempted to re-use and re-enter the administrator password, but cannot
    seem to get the scripts to go back to the 0x0 status. There doesn't seem to
    be much on Microsoft to explain what, specifically, an 0xffffffff error is (a
    few entries mention MOM servers, which I don't have). Are there any
    techniques for troubleshooting 0xffffffff errors?

    The scheduled tasks log has read "
    pbrill1, Jul 1, 2006
  6. You write "I've tried using [reading?] the c:\log.txt
    script [output file?] that Pegasus provided [no, he
    did not!], and I DO get output. <snip>. Although
    the script never runs."

    Well, since the script never runs and since I never
    supplied the contents of c:\log.txt, this file must have
    been created by divine intervention. If you can
    substantiate this claim then you may be eligible for
    the $1,000,000 prize made available by James
    Randy from the Skeptics Society.
    Pegasus \(MVP\), Jul 1, 2006
  7. pbrill1

    pbrill1 Guest

    I am unpleasantly surprised by the nature of this dialog on a Technet Managed
    Exchange newsgroup. I come to this newsgroup as a benefit from Software
    Assurance, where I expect the exchanges to be a bit more professional than
    something I might find if I were to submit a MySpace posting. As I lack
    specific understanding in troubleshooting Scheduled Tasks (they normally just
    work), I come to this site for advice, and not to be chastized for my lack of
    understanding on this specific matter.

    That said, I still have a problem that I would appreciate support with.
    Although my original intent was to run the batch scripts without an
    administrator remaining logged onto the Windows 2000 Server (an option that
    clearly works fine in W2K3 server), that effort failed - and I am now having
    problems with the administrator remaining logged in (and the server locked

    I have attempted to use…"someone's" c:\log.txt method to troubleshoot the
    batch script. I did receive log entries, such as:
    But I've just recently found the following entry in the Scheduled Task's
    "810edi.job" (810edi.bat)
    Finished 6/23/2006 9:30:02 PM
    Result: The task completed with an exit code of (ffffffff).

    I have made NO CHANGES to the batch script (beyond the entries that now
    create the c:\log.txt file, now)…when it read:
    "810edi.job" (810edi.bat)
    Finished 6/21/2006 9:30:01 PM
    Result: The task completed with an exit code of (0).

    It wouldn't have anything to do with the Scheduled Task's ADVANCED - VIEW
    LOG, would it? The 6/21/06 message was at the bottom of this log, and the
    6/23/06 message had rolled over to the top of this log.

    …Supportive advice appreciated.

    pbrill1, Jul 3, 2006
  8. Let's summarise the nature of this thread:
    - You report that you have problems running a scheduled job
    when nobody is logged on.
    - I suggested that you should schedule a two-line batch file,
    then examine the log file it generates.
    - You report that you were using my log file "c:\log.txt". You
    do not appear to appreciate that this log file is GENERATED
    by my batch file. It can be viewed but it cannot be "USED".
    - You also report "Although the script never runs". This is
    clearly contradictory. If you have a log file then the batch
    must have run.
    I get a strong impression that you composed your previous
    report in a hurry, without reading what you wrote. It does not
    appear to come from an experienced systems administrator.
    Hence my facetious reply. However, I am happy to work with
    you on this issue if you take the time to compose your replies
    carefully and examine them in detail before sending them on
    their way. If you feel that your previous reply was sound and
    solid and that it reflects a good understanding of basic batch
    files (as one expects from a sysadmin) then please say so and
    I will gladly leave this issue for another respondent to deal with.

    About your current post: You report that 810edi.bat terminated
    with an exit code of ffffffff but you do not show the batch file
    you used. I recommend you use this batch file for your next test:

    @echo off
    echo %date% %time% batch=%0 %Username% >> c:\log.txt
    echo ErrorLevel=%ErrorLevel% >> c:\log.txt
    type "%0" >> c:\log.txt

    then paste the following details into your reply:
    1. The batch file you used.
    2. The contents of c:\log.txt
    3. The relevant lines from the Task Scheduler log file.

    If I do not see a reply from you within three days then I will stop
    monitoring this thread.

    Pegasus \(MVP\), Jul 4, 2006
    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.