none
PowerShell Script to modify the date and time of a registered scheduled task RRS feed

  • Question

  • Say I had a PowerShell script to do some task named task1.ps1. I have it scheduled to run daily. I have another one named task2.ps1 that is scheduled to run once at say 5am on Dec 25, 2017. It's ready to run again but it's now Dec 25, 2018. I need to run it from a PowerShell script  by modifying the date and time to run on Dec 25, 2018 but now at 6am. I want to do this now so I don't miss Christmas morning. I want to sleep in a little more this year. Say I want to do this for task1.ps1 too and I need to make sure I set it to run at the same time but only once as well. Please I do need to do this but all I see is examples of how to create new tasks. I have tasks already scheduled to run and they work and have ran previously. I can't modify the existing ones from the GUI. That would be defeating the purpose of this script. I know I said I need to do this now but really only because I don't have time to wait until Christmas day. Wishing everyone a wonderful rest of the year! Jerry

    • Moved by Bill_Stewart Wednesday, September 5, 2018 9:57 PM Unanswerable drive-by question
    Thursday, June 28, 2018 9:20 PM

All replies

  • Say I had a PowerShell script to do some task named task1.ps1. I have it scheduled to run daily. I have another one named task2.ps1 that is scheduled to run once at say 5am on Dec 25, 2017. It's ready to run again but it's now Dec 25, 2018. I need to run it from a PowerShell script  by modifying the date and time to run on Dec 25, 2018 but now at 6am. I want to do this now so I don't miss Christmas morning. I want to sleep in a little more this year. Say I want to do this for task1.ps1 too and I need to make sure I set it to run at the same time but only once as well. Please I do need to do this but all I see is examples of how to create new tasks. I have tasks already scheduled to run and they work and have ran previously. I can't modify the existing ones from the GUI. That would be defeating the purpose of this script. I know I said I need to do this now but really only because I don't have time to wait until Christmas day. Wishing everyone a wonderful rest of the year! Jerry

    • Merged by Bill_Stewart Thursday, June 28, 2018 9:33 PM Duplicate
    Thursday, June 28, 2018 9:09 PM
  • I forgot I need to use more current PowerShell versions like maybe V3 or V5. I see a lot of issues with working with the Scheduled Task using some versions. However, I can use newer versions if they work with Get-ScheduledTask, Get-ScheduledTaskInfo, New-ScheduledTask, etc. However, all I really need is to modify the date and time and maybe the daily verses once, etc. I've read online that these command-lets came out in V3 and V4 but what is the real story?

    • Edited by CS-Shooter Thursday, June 28, 2018 9:17 PM
    Thursday, June 28, 2018 9:15 PM