• Task Scheduler Head Scratcher

    Home » Forums » AskWoody support » Windows » Windows 11 » Questions about Windows 11 » Task Scheduler Head Scratcher

    Author
    Topic
    #2727250

    Hey Y’all,

    This one’s got me ripping out what hair I have left!

    Dell Laptop Windows 11 Pro 23H2.
    Macrium Reflect V6-Free.

    Run the backup definition from Reflect and works as it should.
    Run the backup from PowerShell using my Start-ReflectBackup.ps1 program using the same command contained in the Task Scheduler and it works as it should.

    Run the Scheduled Task and it immediately bombs! Turning on Task History gives no useable information. Also bombs if run from within Task Scheduler.

    I’ve deployed this PowerShell/Macrium/Task Scheduler system on almost 100 computers without issue until this one.

    Note: The Scheduled Task is created by the PowerShell program so it’s not a typing error.

    If you want to look at the PS you can find it on my OneDrive download page.
    “Backup for Non-Techies”

    Ideas welcome.

    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!
    Computer Specs

    • This topic was modified 4 months, 3 weeks ago by RetiredGeek.
    Viewing 5 reply threads
    Author
    Replies
    • #2727258

      Sounds to me like a permissions issue to me (i.e. Task Scheduler doesn’t have the necessary permissions to actually run the backup program.)

    • #2727261

      Select the Task in Task Scheduler and select Properties.
      On the General tab look for things like:

      General

      Check Run with highest privileges
      Make Configured for your Windows version

      and the Conditions Tab like:

      Conditions

      Idle conditions and Power conditions match your needs.

      HTH, Dana:))

    • #2727278

      In addition to Dana’s excellent advice above, also go to the “Settings” tab and see if the first box on the list, “Allow task to be run on demand”, is checked.

      That box not being checked drove me nuts several years ago when I wanted to run a task in the list “on demand” (when I selected it in Task Scheduler) and it wouldn’t run.

       

    • #2743410

      Hey Y’all,

      Thanks for the spot on suggestions! Unfortunately, these are not the issue and now it has popped up on a 2nd machine. In between these two machines I installed it on a third machine and no issues!

      FYI: Reflect has no problem running backups directly. I also have other tasks on these machines that run PowerShell programs w/o error.

      So, I’ve developed a debugging sheet to try to systematically work through the problem, see below.

      1. Windows Version & Build Number
      2. PowerShell Version Info
      3. Check UAC settings
      4. Remove “Mark of the Internet” on related files.
      5. Double check & Compare Task settings by exporting task and comparing against exported task from a working machine.
      6. Does Task run from inside the Task Scheduler?
      7. Does Task run from PowerShell console using exported parameters?
      8. Do other tasks invoking PowerShell run correctly?

      I’d welcome any suggestions on things to add to the list.

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #2743433

      Check step 3 about clearing the scheduler cache at 4 Ways to Fix the Windows 10 Task Scheduler When It Malfunctions.

      Have you already tried DISM & SFC?

      Does it run correctly with a clean boot?

      --Joe

      1 user thanked author for this post.
    • #2760995

      Hey Y’all,

      Well I finally solved the mistery!

      It seems that PowerShell doesn’t like Usernames with spaces.
      The user’s name was First Middle Last. I had inklings that this might be the problem but just finally got the machine for an extended period while the owner is on a cruise.

      To test I created another account and setup the backup and it ran like a charm.
      So the next step was to change the USERID and USER Folder name to match.
      I’ve read a lot of stuff about how hard this so I figured I’d put AI on the task.
      I used Perplexity.com and got a reasonable response so I decided to give it a try.
      Here’s my edited version that I verified on the problem machine and I only included the instructions for LOCAL accounts!

      Changing-the-Account-Name-and-Account-Directory

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

      2 users thanked author for this post.
      • #2760999

        Just FYI…

        I went thru a similar process when moving an existing local account’s settings from one PC I still use to another one with all the same programs but a different username and discovered it’s actually not as simple as changing the items in your attached pdf file.

        There are a lot of other locations both in the registry and individual configuration files used by 3rd party apps where the old username is stored (as a either a string or hex value) that can cause “strange symptoms” when running some OS procedures and/or apps.

        Took me a quite a few months of sometimes encountering such problems, sometimes not, before I finally realized that was the culprit by analyzing the error logs when a problem happened.

        I then went back and searched the whole registry & all the config files to find and update any instances of the old username with the new one (there were a bunch of them) and all the “strange symptoms” stopped happening.

        1 user thanked author for this post.
        • #2761113

          n0ads,

          You are correct! This machine didn’t have much on it. I did have to tell Quicken where to locate its files but that was done when I started Quicken no registry entry needed.

          I think most of the registry problems are caused by developers not using good programming practices and hard coding things which could be located easier by using the paths in the Environment, etc. IMHO. Of course there are the legacy programs which always cause issues.

          As always YMMV.

          May the Forces of good computing be with you!

          RG

          PowerShell & VBA Rule!
          Computer Specs

          • #2761116

            I think most of the registry problems are caused by developers not using good programming practices and hard coding things which could be located easier by using the paths in the Environment, etc.

            Totally agree!

            The changes I had to make would have been unnecessary if the developers had used Window’s built-in %USERNAME% and %USERPROFILE% variables (which have existed since Windows XP) instead of having the installation process “hard code” the actual username and user profile directory values.

            Oh well, as they say, hindsight is always 20/20.

    Viewing 5 reply threads
    Reply To: Task Scheduler Head Scratcher

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: