Another Scheduled Task failure in Windows 2008 question

Discussion in 'Windows Server' started by Joe Grover, Oct 20, 2008.

  1. Joe Grover

    Joe Grover Guest

    I have a data replication script set to run twice per day, replicating
    across a point-to-point T1 to an offsite recovery center. The script is as
    follows:

    robocopy c:\DATA\share \\cci-fp1\data-replication\share /R:0 /MIR
    /LOG:"c:\datamirrors\TCC-CCI.Log"
    robocopy c:\DATA\projects \\cci-fp1\data-replication\projects /R:0 /MIR
    /LOG+:"c:\datamirrors\TCC-CCI.Log"
    robocopy c:\DATA\payroll \\cci-fp1\data-replication\payroll /R:0 /MIR
    /LOG+:"c:\datamirrors\TCC-CCI.Log"
    robocopy c:\DATA\adpprogs \\cci-fp1\data-replication\adpprogs /R:0 /MIR
    /LOG+:"c:\datamirrors\TCC-CCI.Log"
    robocopy c:\DATA\estimate \\cci-fp1\data-replication\estimate /R:0 /MIR
    /LOG+:"c:\datamirrors\TCC-CCI.Log"
    robocopy c:\DATA\marketing \\cci-fp1\data-replication\marketing /R:0 /MIR
    /LOG+:"c:\datamirrors\TCC-CCI.Log"
    robocopy c:\DATA\HR \\cci-fp1\data-replication\HR /R:0 /MIR
    /LOG+:"c:\datamirrors\TCC-CCI.Log"
    robocopy c:\DATA\userdata \\cci-fp1\data-replication\userdata /R:0 /MIR /XF
    *.PST IMG*.DAT *.BKF /LOG+:"c:\datamirrors\TCC-CCI.Log"
    robocopy c:\DATA\Principl \\cci-fp1\data-replication\Principl /R:0 /MIR
    /LOG+:"c:\datamirrors\TCC-CCI.Log"
    robocopy c:\DATA\acctg \\cci-fp1\data-replication\acctg /R:0 /MIR
    /LOG+:"c:\datamirrors\TCC-CCI.Log"
    robocopy c:\DATA\admin \\cci-fp1\data-replication\admin /R:0 /MIR
    /LOG+:"c:\datamirrors\TCC-CCI.Log"
    robocopy c:\DATA\Audit \\cci-fp1\data-replication\Audit /R:0 /MIR
    /LOG+:"c:\datamirrors\TCC-CCI.Log"
    robocopy c:\DATA\mc2net \\cci-fp1\data-replication\mc2net /R:0 /MIR
    /LOG+:"c:\datamirrors\TCC-CCI.Log"
    robocopy c:\DATA\technology \\cci-fp1\data-replication\technology /R:0 /MIR
    /XF *.PST IMG*.DAT /LOG+:"c:\datamirrors\TCC-CCI.Log"
    robocopy c:\DATA\winapps \\cci-fp1\data-replication\winapps /R:0 /MIR
    /LOG+:"c:\datamirrors\TCC-CCI.Log"
    robocopy c:\DATA\mfxp \\cci-fp1\data-replication\mfxp /R:0 /MIR
    /LOG+:"c:\datamirrors\TCC-CCI.Log"

    This weekend I migrated all of our data off from our old fileserver (Windows
    2000 Server) onto a new fileserver (Windows Server 2008 Standard). I made
    the following two modifications to the script on the new server:

    1. I changed the source from "D:\foldername" to "c:\DATA\foldername"
    2. The old script used the > and >> commands to output to the logfile. I
    had another script I was trying to run on this server that would not run on
    its schedule until I changed this option to use Robocopy's /LOG option.
    After doing so the task ran on its schedule. Because of this I changed all
    of the > commands to /LOG and all of the >> commands to /LOG+.

    The task is set to run using domain admin account credentials. Logged into
    the fileserver as this account and double-clicking on the script
    (TCC-CCI-DataMirror.cmd) made it run fine (I did it for the initial
    replication). However, when it was scheduled to run at 11:45am today, it
    did not complete. The Task Schedule shows the last run result is 0xB.

    The task has two triggers, one to run at 11:45 AM every day, and another to
    run at 11:45 PM every day. It is set to run whether a user is logged in or
    not.

    What is 0xB? This account has full rights on the log folder, as I have
    another script running as the same account and logging to the same location
    that completes successfully. I am having difficulty tracking down what
    result 0xB means. Any help is appreciated. Thanks!

    Joe
     
    Joe Grover, Oct 20, 2008
    #1
    1. Advertisements

  2. I would insert the following instruction after each robocopy command, e.g.
    like so:
    echo ErrorLevel=%ErrorLevel% for c:\DATA\share >> c:\TaskScheduler.log
    echo ErrorLevel=%ErrorLevel% for c:\DATA\projects >> c:\TaskScheduler.log

    This would tell you which of your many commands is causing a problem.
     
    Pegasus \(MVP\), Oct 20, 2008
    #2
    1. Advertisements

  3. Joe Grover

    Joe Grover Guest

    Do I do that on the next line, or at the end of the line after the /LOG
    statement like this:

    robocopy c:\DATA\share \\cci-fp1\data-replication\share /R:0 /MIR
    /LOG:"c:\datamirrors\TCc-CCI.Log" echo ErrorLevel=%ErrorLevel% for
    c:\DATA\share >> c:\TaskScheduler.log
     
    Joe Grover, Oct 20, 2008
    #3
  4. Joe Grover

    Joe Grover Guest

    Actually, it looks like it did run. I hadn't checked the log, I only
    checked the Last Run Result, which I expected to say "the operation
    completed successfully."

    Does anyone know what 0xB means? The script ran and completed, there were
    just some errors in the copy due to denied access (in-use Citrix profiles,
    etc, which are to be expected).
     
    Joe Grover, Oct 20, 2008
    #4
  5. The code is generated by robocopy.exe, which is why I recommended that you
    track the robocopy return codes.
     
    Pegasus \(MVP\), Oct 20, 2008
    #5
  6. Joe Grover

    Joe Grover Guest

    =========================/

    Actually, it ran, but there's something funky going on.

    The first thing it replicates is C:\DATA\share. The file permissions of
    this folder and its subdirectories are:

    - Domain Admins (full control)
    - Domain Users (modify)
    - Local server Administrators group (full control)

    According to the script log, this folder copies just fine.

    The next folder it replicates is C:\DATA\projects. The file permissions of
    this folder is:

    - Domain Admins (full control)
    - Local server Administrators group (full control)
    - Corp Users (no permissions on root folder)
    - Subcorp Users (no permissions on root folder)
    - Misc Field Personnel (no permissions on root folder)
    - Clerical (read only)
    - Architects (read only)
    - Marketing (read only)
    - Accounting (read only)
    - Safety (read only)
    - Principals (read only)
    - Sharepoint Indexer (read only)

    This folder however fails with the following error:

    2008/10/20 11:56:09 ERROR 5 (0x00000005) Accessing Source Directory
    c:\DATA\projects\
    Access is denied.

    The script is set to run using the domain administrator logon. I checked to
    ensure that this account is not listed in any of the groups that have no
    access to the root folder above. It is in Domain Admins, Domain Users (not
    in the list above), Enterprise Admins, Group Policy Creator Owners, Schema
    Admins, and a user group called Technology.

    When my script runs as the scheduled task, I get several folders that don't
    get replicated that are similar to above (for example, C:\DATA\acctg will
    copy, but C:\DATA\userdata will not).

    If I log into the fileserver as this account and double-click on the script,
    it runs normally and can access all of the folders. I can browse the
    referenced folders while logged in. I've retyped the password when editing
    the scheduled task, but still get this error.
     
    Joe Grover, Oct 21, 2008
    #6
  7. Add the following command to your backup batch file:
    echo User=%UserName% >> c:\TaskScheduler.log
    net user "%UserName% >> c:\TaskScheduler.log
    cacls c:\DATA\projects\ >> c:\TaskScheduler.log
    xcopy /y /c c:\Data\projects c:\Test\ 1>>c:\TaskScheduler.log 2>>&1

    The log file should now have sufficient information to tell you what's going
    on.
     
    Pegasus \(MVP\), Oct 21, 2008
    #7
    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.