Windows 10: Problem Getting a Powershell Script to Run in Task Scheduler

Discus and support Problem Getting a Powershell Script to Run in Task Scheduler in Windows 10 Software and Apps to solve the problem; Hope I'm in the right place! I am trying to get a Powershell script to run daily in the task scheduler. It basically purges a folder on one of my... Discussion in 'Windows 10 Software and Apps' started by Aguden, Nov 5, 2016.

  1. Aguden Win User

    Problem Getting a Powershell Script to Run in Task Scheduler


    Hope I'm in the right place!

    I am trying to get a Powershell script to run daily in the task scheduler. It basically purges a folder on one of my drives:

    Get-ChildItem –Path “D:\Dropbox\Quicken\Backup” –Recurse | Where-Object CreationTime –lt (Get-Date).AddDays(-10) | Remove-ItI

    I can run it from a CMD prompt and I set it up in the task scheduler and it seemed to run one time on schedule and then hasn't run since that initial time. I have tried to run it manually from the task scheduler but it gets and error "Task Start Failed."

    I have attached copies of the properties tabs and the main view of the task scheduler with the History showing. Any ideas? I didn't find a tutorial, but I'm sure there is something on the website!

    Cordially,

    Al Guden

    TS-TaskView.pdf
    PROPERTIES-Settings.pdf
    PROPERTIES-Actions.pdf
    PROPERTIES-Triggers.pdf
    PROPERTIES-General.pdf
    PROPERTIES-History.pdf
    PROPERTIES-Conditions.pdf

    :)
     
    Aguden, Nov 5, 2016
    #1

  2. Task Scheduler trigger "On disconnect from user session" does not work in Windows 10 Home?

    We are volunteers willing to help you try to resolve this issue.

    How to: Run PowerShell Scripts from Task Scheduler

    https://community.spiceworks.com/how_to/17736-r...

    PowerShell for beginners: Scripts and loops

    https://www.computerworld.com/article/2879205/d...

    OR

    How to schedule a Batch File to run automatically in Windows 10/8/7

    http://www.thewindowsclub.com/how-to-schedule-b...

    How to run a batch file at a specific time

    How to run a batch file at a specific time

    More support for Task Scheduler and scripting in the Microsoft TechNet

    Forums.

    TechNet - Windows 10 IT Pro - Forums

    https://social.technet.microsoft.com/Forums/win...

    Windows - PowerShell

    https://social.technet.microsoft.com/Forums/Win...

    Please let us know the results and if you need further assistance.
     
    SpiritX MS MVP, Nov 5, 2016
    #2
  3. SKC-PSI Win User
    Create a PowerShell script to create a copy

    I am having trouble with the powershell script. I have used powershell in very limited amounts, so am unfamiliar to the scripts that would be required to do the jobs that I desire, nor how to save the script so that it can be accessed by the scheduler.
     
    SKC-PSI, Nov 5, 2016
    #3
  4. dalchina New Member

    Problem Getting a Powershell Script to Run in Task Scheduler

    dalchina, Nov 5, 2016
    #4
  5. Aguden Win User
    Thank you for the help. The 2nd article had the little nugget I needed. -ExecutionPolicy Bypass before the PS1 file did the trick. I started using a PS1 file but couldn't get past the errors with scripts being prohibited. This did the trick. It runs manually. Now we will see if it runs on schedule.

    Thanks again.

    Al
     
    Aguden, Nov 5, 2016
    #5
  6. dalchina New Member
    Glad it helped- the answer's often 'out there'...
     
    dalchina, Apr 5, 2018
    #6
Thema:

Problem Getting a Powershell Script to Run in Task Scheduler

Loading...
  1. Problem Getting a Powershell Script to Run in Task Scheduler - Similar Threads - Problem Getting Powershell

  2. Problem getting a powershell script to run in Task Scheduler

    in Windows 10 Software and Apps
    Problem getting a powershell script to run in Task Scheduler: Hello. I am trying to get a PowerShell script to run once every half hour in the Task Scheduler utility. The platform is Windows Server 2019 Standard Edition. I configured the script to run on a schedule starting at 12:00 AM every day, and repeat every 30 minutes...
  3. Problem getting a powershell script to run in Task Scheduler

    in Windows 10 Gaming
    Problem getting a powershell script to run in Task Scheduler: Hello. I am trying to get a PowerShell script to run once every half hour in the Task Scheduler utility. The platform is Windows Server 2019 Standard Edition. I configured the script to run on a schedule starting at 12:00 AM every day, and repeat every 30 minutes...
  4. Scheduled Task to run powershell script via GPOcomputer on a particular day

    in Windows 10 Gaming
    Scheduled Task to run powershell script via GPOcomputer on a particular day: Hi Reader, How to create a scheduled task to run a powershell script whether user is logged on or not during a specific time via GPO. I have implemented it locally using the following settings, which prompts for the user account password while creating the scheduled task....
  5. Scheduled Task to run powershell script via GPOcomputer on a particular day

    in Windows 10 Software and Apps
    Scheduled Task to run powershell script via GPOcomputer on a particular day: Hi Reader, How to create a scheduled task to run a powershell script whether user is logged on or not during a specific time via GPO. I have implemented it locally using the following settings, which prompts for the user account password while creating the scheduled task....
  6. Scheduled Task to run powershell script via GPOcomputer on a particular day

    in Windows 10 Network and Sharing
    Scheduled Task to run powershell script via GPOcomputer on a particular day: Hi Reader, How to create a scheduled task to run a powershell script whether user is logged on or not during a specific time via GPO. I have implemented it locally using the following settings, which prompts for the user account password while creating the scheduled task....
  7. Powershell script does not run via Task Scheduler

    in Windows 10 Customization
    Powershell script does not run via Task Scheduler: PowerShell script runs fine manually, but doesn't run in Task scheduler. The script: [ATTACH] I tried another command$env:COMPUTERNAME and works fine both manually and via PowerShell....
  8. PowerShell script does not run as Scheduled Task – 0xFFFD0000 error

    in Windows 10 News
    PowerShell script does not run as Scheduled Task – 0xFFFD0000 error: [ATTACH] [ATTACH]The Windows 10 Task Scheduler is a boon for a group of users who like to schedule different tasks and automate them. I use it all the time to schedule periodic execution of scripts and some programs to ensure my [...] This post PowerShell script does not run...
  9. Window 10 with WSL Task Scheduler task run at Startup/Logon running a PowerShell script...

    in Windows 10 Installation and Upgrade
    Window 10 with WSL Task Scheduler task run at Startup/Logon running a PowerShell script...: Here is the content of PowerShell script I am trying to run via a startup or log on task created via Task Scheduler in Windows 10. #power shell file saved as autostartsshd.ps1 bash -c 'sudo service ssh start' This runs fine when run with powershell. But running from...
  10. Task Scheduler doesn't run script

    in Windows 10 Software and Apps
    Task Scheduler doesn't run script: Hey Microsoft Community, I'm trying to create a task in Task Scheduler that runs a specific script. The issue is that when the task runs (whether I do it manually or if it's scheduled), the script doesn't actually get executed. I know that the script works, and I have tried...