Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Jan 2002
    Location
    Midlothian, Virginia, USA
    Posts
    875
    Thanks
    0
    Thanked 2 Times in 1 Post

    Can Scheduler Tasks Be Moved to New PC

    I have quite a few tasks defined in the System Scheduler on my old Vista laptop. Can they be moved as a group to the System Scheduler on my new Win8.1 laptop? If so, how?

    Thanks,
    Bill

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Bill,

    As a group No as far as I know.

    You can Export (from within TS) to a folder or USB key then Import them on the other machine. There is one glitch though the machine name/userid will of course change and you need to fix that.
    Code:
    <?xml version="1.0" encoding="UTF-16"?>
    <Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
      <RegistrationInfo>
        <Date>2013-03-27T20:35:32.9539289</Date>
        <Author>Dell1564LT\Bruce</Author>
      </RegistrationInfo>
      <Triggers />
      <Principals>
        <Principal id="Author">
          <UserId>Dell1564LT\Bruce</UserId>
          <LogonType>InteractiveToken</LogonType>
          <RunLevel>HighestAvailable</RunLevel>
        </Principal>
      </Principals>
      <Settings>
        <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
        <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
        <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
        <AllowHardTerminate>true</AllowHardTerminate>
        <StartWhenAvailable>false</StartWhenAvailable>
        <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
        <IdleSettings>
          <StopOnIdleEnd>true</StopOnIdleEnd>
          <RestartOnIdle>false</RestartOnIdle>
        </IdleSettings>
        <AllowStartOnDemand>true</AllowStartOnDemand>
        <Enabled>true</Enabled>
        <Hidden>false</Hidden>
        <RunOnlyIfIdle>false</RunOnlyIfIdle>
        <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
        <UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine>
        <WakeToRun>false</WakeToRun>
        <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
        <Priority>7</Priority>
      </Settings>
      <Actions Context="Author">
        <Exec>
          <Command>%windir%\system32\WindowsPowerShell\v1.0\PowerShell.exe</Command>
        </Exec>
      </Actions>
    </Task>
    I've written a PowerShell script to do just that and would be glad to share if you are interested.

    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. #3
    5 Star Lounger
    Join Date
    Jan 2002
    Location
    Midlothian, Virginia, USA
    Posts
    875
    Thanks
    0
    Thanked 2 Times in 1 Post
    Thanks RG. I guess I will just create the ones I need on the new machine and in that process weed out the ones I really don't need.

    Bill

  4. #4
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,199
    Thanks
    48
    Thanked 987 Times in 917 Posts
    Here's something I made earlier.

    cheers, Paul

    Don't Lose Those Task Scheduler Jobs
    Venerable old Windows Task Scheduler has many uses and is great for those one off copy overnight jobs we all need to do. Unfortunately, some people insist on using them for production jobs and the chances of being able to restore them after a crash are not good - unless you restore the entire system from backup.

    Luckily, Microsoft have come to the rescue with a Windows 2000 Resource Kit command line utility called JT.EXE. Mind you, it is one of those files that isn't actually included in the RK, you have to download it from Microsoft. To make matters worse, the syntax is obscure and documentation non-existant. Command line help is available but limited, so after I had struggled to make sense of it....

    JT Basics
    JT allows you to work with existing schedule jobs or create new ones, but you must load the job, or the shell of a new one, into memory before JT will play ball. Once the job is available to JT, you can print out details, modify, copy, save etc. When JT exits, it removes the job details from memory.

    Start by getting a list of existing schedules: jt /se

    Now load the require job into memory: jt /sac jobname

    Print the job details: jt /sac jobname /pj

    User credentials are the account under which the scheduled job runs - passwords are not recoverable with JT.

    Print the job details and the user credentials: jt /sac jobname /pj /gc

    You might want two copies of the job running - I don't know why you would, but you might.

    Save the job as a new task with a different name: jt /sac jobname /saj newname

    Save the job elsewhere without creating a new task - great for backup: jt /sac jobname /svj path\newname

    Create a new job using an existing file as a template, then save it: jt /lj path\backupofjobname /saj jobname

    How Can I Backup Scheduled Tasks
    You can print out the job description, but re-creating the job from a description is a parsing nightmare. It's much easier to save it in it's original binary form, then you only need to set the user credentials when you restore it.
    The following script will backup all existing scheduled jobs, saving the description and credential name, along with the job file itself and an index to the jobs. You can then use the index to restore the jobs automatically.

    The script now retains spaces in job names.

    Schedule_backup.cmd
    Code:
    @echo off
    ::Enumerate all jobs
    jt /se | findstr /l /v "[TRACE]"> joblist.txt
     
    ::Print job info from joblist. Activate job, then print it, including credentials.
    ::jt /sac jobname /gc /pj
    for /f "tokens=*" %%x in (joblist.txt) do jt /sac "%%x" /pj /gc > "%%x.txt"
     
    ::Save job as binary, get names from joblist. Activate job, then save it.
    ::jt /sac jobname /svj path\jobname.bin
    for /f "tokens=*" %%x in (joblist.txt) do jt /sac "%%x" /svj "%%x.bin"
    Restore Scheduled Tasks
    This script restores the jobs saved above - it gets the job names from joblist.txt.

    Schedule_restore.cmd
    Code:
    @echo off
    ::Load jobs back in.
    ::You have to set the logon credentials manually.
    for /f "tokens=*" %%x in (joblist.txt) do jt /lj "%%x.bin" /saj "%%x"
    
    ::Auto credentials when you load jobs
    for /f "tokens=*" %%x in (joblist.txt) do jt /lj "%%x.bin" /sc username password /saj "%%x"
    Syntax
    The syntax is available by running JT without any paramaters, or you can read it at Rob van der Woude's page.
    Oh, there is a utility in Windows XP/2003 called schtasks, but it is actually less powerful than JT.
    Last edited by Paul T; 2015-07-30 at 04:00.

  5. #5
    5 Star Lounger
    Join Date
    Jan 2002
    Location
    Midlothian, Virginia, USA
    Posts
    875
    Thanks
    0
    Thanked 2 Times in 1 Post
    Thanks Paul T for that tutorial on how to save and restore scheduled tasks. I may try that on my old laptop and see what I get. Since I can't display messages within the scheduler on Win8 I may not be able to make use of your script to restore all of the tasks at once to my new laptop. However I should be able to backup the new tasks and restore them using this approach.

    Thanks for the details.
    Bill

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •