Announcement

Collapse
No announcement yet.

Scheduled Task Runs with No Effect (and no Errors)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scheduled Task Runs with No Effect (and no Errors)

    Hi. I'm really baffled by a backup task I created. It runs on it's own every 24 hours, but sadly had no effect.

    Here's what I did:

    1) Created a file called BACKUP.CMD containing the following:
    XCOPY D:\KerioMail \\QNAP1\BACKUPS\KerioMail /E/D/C/R/Y/Z
    XCOPY D:\M90-44 \\QNAP1\BACKUPS\M90-44 /E/D/C/R/Y/Z
    XCOPY D:\FTP \\QNAP1\BACKUPS\FTP /E/D/C/R/Y/Z
    This copies files from the data drive (D) to our backup server (QNAP1).

    If I double click the BACKUP.CMD file in windows or run it from a DOS prompt (I'm using Windows Server 2008 R2), it executes correctly and all files are backed up.

    So, I:

    2) Created a Scheduled Task that is supposed to execute this BACKUP.CMD file every night.

    I found no errors in the Event logs, and according to the Task Schedule log, the task runs every night. I see items such as "Task triggered on scheduler", "Task Engine received message to start task", "Task Started", "Action Started", "Create Task Process", "Action Completed", "Task Completed".

    However, the end result is nothing. No files get copied. I can also Run this scheduled task manually and nothing gets copied either.

    If I go into the properties of my task, and look at actions, it shows Action as "Start a program" and Details as "C:\Program Files\BACKUP.cmd". This is where I put my BACKUP.cmd file... and as mentioned above, if I double click on it, the backup completes successfully.

    I thought it might have something to do with rights, but when I login as the administrator, I can execute the cmd file directly and it works, and I can run the task while being logged in and it doesn't do anything.

    Any ideas? I'm sure I must be doing something wrong, but I don't know what it is.

    Thank you.

  • #2
    Re: Scheduled Task Runs with No Effect (and no Errors)

    Check on the credentials used with the scheduled task. If it's not your own creds (and shouldn't be), it may very well be that the name used doesn't have the user right to 'log on as a batch job.' By default, administrators have this right, and that's why you can run the cmd yourself, but not the task.

    I've had this same issue, and this was the solution. In the appropriate Group Policy, add the scheduled task username to the setting 'Computer Configuration | Windows Settings | Security Settings | Local Policies | User Rights Assignment | Log on as a batch job.' On the subject box at a cmd prompt, run 'gpupdate /force', reboot if prompted, then set the task to run again.

    Exactly where you set that is down to how your environment is set up.
    *RicklesP*
    MSCA (2003/XP), Security+, CCNA

    ** Remember: credit where credit is due, and reputation points as appropriate **

    Comment


    • #3
      Re: Scheduled Task Runs with No Effect (and no Errors)

      Thank you for your reply.

      My task is setup to execute as the local Administrator.

      I checked the settings you were talking about. I found them under Control Panel / Administrative Tools / Local Security Policy / Local Policies / User Rights Assignment / Log on as a batch job.

      Unfortunately, Administrators was already listed.

      Comment


      • #4
        Re: Scheduled Task Runs with No Effect (and no Errors)

        put some debug in the very top of your cmd batch file - that way you can at least work out if that file is even being triggered ?
        Please do show your appreciation to those who assist you by leaving Rep Point https://www.petri.com/forums/core/im.../icon_beer.gif

        Comment


        • #5
          Re: Scheduled Task Runs with No Effect (and no Errors)

          Not sure why your script isn't working as a task.

          I have a script setup to check for old computers and it is almost exactly as you mentioned and it works flawlessly.

          The only difference that i have in mine is the Start InOptional) setting for which i have put the location of the script file in. Try that and see what happens.

          I have created a test using some edited commands that redirect to a folder on the local machine and the script ran exactly as expected when set as a task.

          Could you please attach screen shots of the actual task.

          Comment


          • #6
            Re: Scheduled Task Runs with No Effect (and no Errors)

            Originally posted by hayedid View Post
            My task is setup to execute as the local Administrator.
            What happens if you specify the domain administrator or the local administrator account on \\QNAP1?

            [Edit]
            Or your own account which obviously seems to work?
            Last edited by Blood; 29th November 2012, 17:30.
            A recent poll suggests that 6 out of 7 dwarfs are not happy

            Comment

            Working...
            X