Announcement

Collapse
No announcement yet.

Schedule a task logged into terminal services

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

  • Schedule a task logged into terminal services

    I have two windows 2000 servers running at remote locations. Both of these servers are running application mode ts. I have a batch file that I can execute perfectly when I click on it, but when I schedule it to run from control panel\schedule tasks, it never seems to run completely. I cant find any info in the event logs that explain what the problem is. I have a couple other 2000 servers that I am able to schedule the same batch file directly at the console with success. The batch file is simple and looks like this:

    If exist c:\DRIVEMARKER.txt set BackupDrive=f
    If exist Y:\DRIVEMARKER.txt set BackupDrive=y
    If exist z:\DRIVEMARKER.txt set BackupDrive=z
    Set FolderName=%date:~4,2%%date:~7,2%%date:~-4%
    md %backupdrive%:\%foldername%
    %backupdrive%:
    cd %foldername%
    md access
    md bob
    md cobas30
    md dfprog3d
    md excel
    xcopy g:\access\*.* %backupdrive%:\%foldername%\access /e /h /k
    xcopy g:\bob\*.* %backupdrive%:\%foldername%\bob /e /h /k
    xcopy g:\cobas30\*.* %backupdrive%:\%foldername%\cobas30 /e /h /k
    xcopy g:\dfprog3d\*.* %backupdrive%:\%foldername%\dfprog3d /e /h /k
    xcopy g:\excel\*.* %backupdrive%:\%foldername%\excel /e /h /k

    Like I said the exact code here can be scheduled and run successfully from schedule created at the console of a 2000 server but not from remote login via terminal services.

  • #2
    Re: Schedule a task logged into terminal services

    First of all.. Using scripts to backup server is bad idea.
    Second, there no logic to make TS file server.
    And last.. Under whice account permission to task run?
    Best Regards,

    Yuval Sinay

    LinkedIn: https://www.linkedin.com/in/yuval14, Blog: http://blogs.microsoft.co.il/blogs/yuval14

    Comment


    • #3
      Re: Schedule a task logged into terminal services

      The terminal server is newer then the file server at that location. We use removeable hard drives for our back-up which require usb 2.0(only found on the newer TS server). The terminal server is only used by 2-3 people at a time during 8am-5pm. After hours I use it as a back-up server for the file server. Whats wrong with that. I have always used scripts and found them to be reliable.

      Comment


      • #4
        Re: Schedule a task logged into terminal services

        The account being used to run the script, is the administrator account. It works with no issues if I am standing right in front of a server. But like I said, if I try to schedule it on my terminal server logged in remotely, no go.....nothing!

        Comment


        • #5
          Re: Schedule a task logged into terminal services

          no one has any clue?

          Comment


          • #6
            Re: Schedule a task logged into terminal services

            personally i would use ntbackup if you haven't any backup software. Why? what about recovering windows, or AD or something like that? what about file permission backups?
            scripting is more poremans then ntbackup is my oppinion.

            the eventlog will say something if i remember it good..
            but ehmm where do you create the remote drives? i don't see the net use commands.
            Marcel
            Technical Consultant
            Netherlands
            http://www.phetios.com
            http://blog.nessus.nl

            MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
            "No matter how secure, there is always the human factor."

            "Enjoy life today, tomorrow may never come."
            "If you're going through hell, keep going. ~Winston Churchill"

            Comment


            • #7
              Re: Schedule a task logged into terminal services

              We have vertias back-up exec version 8.6 for 2000 servers. I used it for years with our tape drive. When the tape drive packed it in for the third time in 4 years, we decided to go with usb 2.0 hard disks. Vertias is not user friendly when it comes to trying to make the backup happen on the hard disk. After months of screwing around with vertias, I went to using ntbackup. Ntbackup was working great, but there were some unexplainable instances that occured while I was using it, and I just wanted something easy to use. My script below basically says, create a directory named after the date for the name on any drive letter that contains my marker file "drivemarker.txt". The reason why I have it choose the backup device that way is because we have multiple removable hard disks that we plug in for this backup and they show up as different drive letters. That way I can use the same batch file no matter what hard disk is pluged in. i love it, because the xcopy copies everything to a tee with all permisions in tact. Restoring files has never been easier for me. Just drag and drop. As far as active directory is concerned, I have cloned hard disk's sitting on a shelf in starage in the event that ad would mess up. Aside from all of that, I have always had one problem, and that was that I could not schedule that batch file to run while logged remotley via terminal services into a terminal server running in application mode. I had the same problem with trying to schedule ntbackup utilty as well. That is the problem here

              Comment


              • #8
                Re: Schedule a task logged into terminal services

                I have more information regarding this problem. When I check the log created by the scheduler, it shows these entries after I tested the task schedule 3 times.

                Started 12/22/2005 9:58:00 PM
                "BACKUP.job" (BACKUP.bat)
                Finished 12/22/2005 9:58:00 PM
                Result: The task completed with an exit code of (4).
                "BACKUP.job" (BACKUP.bat)
                Started 12/22/2005 10:04:00 PM
                "BACKUP.job" (BACKUP.bat)
                Finished 12/22/2005 10:04:00 PM
                Result: The task completed with an exit code of (4).
                "BACKUP.job" (BACKUP.bat)
                Started 12/22/2005 10:06:00 PM
                "BACKUP.job" (BACKUP.bat)
                Finished 12/22/2005 10:06:00 PM
                Result: The task completed with an exit code of (4).
                [ ***** Most recent entry is above this line ***** ]


                Error Code 4. Cant seem to find any info on this error.....Any idea's

                Comment


                • #9
                  Re: Schedule a task logged into terminal services

                  http://www.tek-tips.com/viewthread.cfm?qid=859389

                  Had trouble running the xcopy command also.. my scheduled bat file(to xcopy files), initially would run, but after a a week or two the scheduled command would not work ( repeatable). I ended up using the robocopy command, no problem since.

                  1 minut of google
                  Marcel
                  Technical Consultant
                  Netherlands
                  http://www.phetios.com
                  http://blog.nessus.nl

                  MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
                  "No matter how secure, there is always the human factor."

                  "Enjoy life today, tomorrow may never come."
                  "If you're going through hell, keep going. ~Winston Churchill"

                  Comment


                  • #10
                    Re: Schedule a task logged into terminal services

                    Try using schtasks.exe that comes with 2003/XP to schedule tasks on remote servers.

                    Also make sure that the account used to run the task has the "Logon as batch job" and "Backup files and directories" user rights
                    Guy Teverovsky
                    "Smith & Wesson - the original point and click interface"

                    Comment


                    • #11
                      Re: Schedule a task logged into terminal services

                      I tried copying the task sched exe file from xp to my 2000 server. Will not run in 2000 server environment. I think that part of the problem is actually caused by my xcopy command in the batch file. Why I dont know? When I execute the batch file by clicking on it, it completes successfully, but if I schedule it, it only accomplishes the first couple line of my batch file that are responsible for creating the back-up directories. After that, it stops. Doesn't copy any data. I was thinking about trying that ROBOCOPY. Not sure if that will work in 2000 server though. The only thing that doesn't explain the failure, is that I get the same results when I try to schedule a job using the ntbackup utility. I am really suprised that no one else has seen this. I can go home and install 2000 server from scratch and set it up to be a terminal server operating in application mode successfully and still have the same scheduling issue. I personally think that it has something to do with the user rights that are being applied tot he batch file when it scheduled to run. The only problems is, I dont understand why the administrator of a computer cant schedule things like this.
                      Any ideas? Help!!!

                      Comment


                      • #12
                        Re: Schedule a task logged into terminal services

                        well i've never seen this before, but lets try to make some progress
                        try robocopy. it works on windows 2000.
                        try schtasks.exe, like guyt recommends.
                        Marcel
                        Technical Consultant
                        Netherlands
                        http://www.phetios.com
                        http://blog.nessus.nl

                        MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
                        "No matter how secure, there is always the human factor."

                        "Enjoy life today, tomorrow may never come."
                        "If you're going through hell, keep going. ~Winston Churchill"

                        Comment


                        • #13
                          Re: Schedule a task logged into terminal services

                          schtasks.exe from xp does not work in the 2000 environment. I copied robocopy over to my 2000 terminal server and added the commands to my batch file. I scheduled the the batch to run and it did. Why it worked, I dont know. I have never used robocopy before. I was wondering if anyone could tell if I my syntax is good enough for backups.

                          ROBOCOPY \\vnbserver\data %backupdrive%:\%foldername%\data /mir

                          is "/mir" enough. Mir is mirror of the source? Does anyone else recommend me using more switches with robocopy?

                          Comment


                          • #14
                            Re: Schedule a task logged into terminal services

                            /Z : copy files in restartable mode (survive network glitch).
                            or /ZB : use restartable mode; if access denied use Backup mode.

                            /R:n : number of Retries on failed copies - default is 1 million.
                            set n to 10

                            /LOG:file : output status to LOG file (overwrite existing log).


                            http://www.ss64.com/nt/robocopy.html

                            maybe the switches u can use are a little bit different, but the idea is there it think.

                            put it in restartble mode. if there is a network glitch, you problaby still want that file. also lower the retries. 1 million is a bit to much, and can cause a backup of days.
                            also enable logging, so you can see any problems if they occur
                            Marcel
                            Technical Consultant
                            Netherlands
                            http://www.phetios.com
                            http://blog.nessus.nl

                            MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
                            "No matter how secure, there is always the human factor."

                            "Enjoy life today, tomorrow may never come."
                            "If you're going through hell, keep going. ~Winston Churchill"

                            Comment


                            • #15
                              Re: Schedule a task logged into terminal services

                              Wondering if this is all a TS issue...
                              I'll try to do this from the console tomorrow and post my results..
                              Have had issues with this for the past week or more and it is really starting to ....
                              me off!

                              Comment

                              Working...
                              X