Edit Duration and repetition interval for an existing job in a Powershell oneliner RRS feed

  • Question

  • Hi All

    I have enabled a job that repeats daily once. Like:

    Register-ScheduledJob -Name SomeJob -Credential host00\idiot00 -ScriptBlock {Some-Job} -Trigger (New-JobTrigger -Daily -At "21:00")

    I want to edit the job, obviously, as no job might complete if it runs with permissions of "idiot00". Additionally, in case the computer is down, the system should try to run the job again as soon as the computer is up again. With success I only get as far as this:

    Get-ScheduledJob SomeJob | Set-ScheduledJob -Credential host00\SYSTEM -Trigger (New-JobTrigger -Daily -At "19:00")

    Yes, I can even change the time ("19:00").

    I'm getting errors as soon as I try to insert some RepetitionInterval or RepetitionDuration. So I might need something like:

    –RepetitionInterval 0:15 –RepetitionDuration 3:00

    That is: I want the system try repeat the job for 3 hours every 15 minutes.

    I've tried lots, googled even more, to no avail.

    Please: Don't give me scripts - I'm not interested at all. Just tell me, if possible, whether I can complete the task in a oneliner in Powershell, and if yes, you maybe even know how to do that.

    Thanks in anticipation.

    And this:
    Anyone out there who can tell me how to switch of this cursor in the message editing field of this forum, that deletes everything following of what I type, instead of simply marking the place where I want to add text? Never seen something like that ...
    • Moved by Bill_Stewart Friday, November 28, 2014 4:47 PM This is not "scripts on demand"
    Wednesday, September 24, 2014 9:40 PM


  • I would recommend starting by reading  the help for scheduled jobs and the CmdLets.   You seem to not understand how they work.

    Jobs are triggered by "triggers"  You have not defined a trigger. The help wil show you how to create and add triggers.

    'credential" does not define who the job runs as.

    Help is the best place to start.  You can also look for blogs that explain how to use this subsystem.

    Like this one: http://blogs.technet.com/b/heyscriptingguy/archive/2012/09/18/create-a-powershell-scheduled-job.aspx


    • Proposed as answer by jrv Wednesday, September 24, 2014 11:05 PM
    • Marked as answer by Just Karl Friday, May 1, 2015 10:02 PM
    Wednesday, September 24, 2014 11:05 PM