Modify a scheduled task without running it

It seems that when I use PowerShell's Set-ScheduledTask command (or the SchTasks command line utility) that the task runs immediately after being modified.

Is there a way to modify the task and NOT have it run immediately, but only run at its next scheduled time?

Thanks.  Greg.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sounds as though the task when created has the trigger set to run on creation or on modification.
Make sure to change the -trigger when editing to make sure it is not on create/modify.
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
The default behaviour is not to run on creation or modification, so I agree to arnold.
malcolm29Author Commented:
Thank you both.  I was unable to determine where, using the new-scheduledtasktrigger or the set-scheduledtask commands, I could set the trigger as Arnond suggested.  However, I did discover that if I modify an existing task that is set to run periodically, that if the start date and time are in the past that the task will trigger because it sees that the interval has passed.  If I use new-scheduledtasktrigger to set the start date and time in the future, it does not run upon being changed.

If you can show me a command that can modify the trigger as you suggest, I will investigate that as well.

Thanks for you help!
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
The behaviour you described may result from the setting of
 (get-scheduledtask test).Settings.StartWhenAvailable

Open in new window

being True for the task. You can change that e.g. with
get-scheduledtask test | % { $_.Settings.StartWhenAvailable = $true; $_ } | Set-ScheduledTask

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The MS doc has several examples it all depends on what it is you are changing.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.