Tomcat
Tomcat

Reputation: 43

Changing a scheduled task from cmd

SchTasks /Change /TN "cs2kconnect" /ST 06:00

I am getting Error the Parameter is Incorrect

The taskname is correct as I copied it directly, and when I put in a bad time it says /ST is Invalid.

I have managed to edit it other tasks using the same process, just this one does not want to change have tested this on multiple machines.

Any ideas?

This is running under windows 7

Upvotes: 0

Views: 2361

Answers (2)

hucha
hucha

Reputation: 1

I had this issue and found out that "Synchronize accross time Zones" in trigger is checked. Uncheck this box then command SchTasks /Change will work.

Upvotes: 0

Dipen Parekh
Dipen Parekh

Reputation: 86

Though the question is very old but my answer below could be helpful to anybody still searching.

If you have made sure the name of the task and the parameter values are all correct and still face this error, then it is not because of the command you are running but because of the setup of the task.

You will face this error in 2 cases, first is when you create a Scheduled Task from the GUI and add a Trigger and not change the default Start Time. Second is when you add an Expire date and not change the default date that is set. Task Scheduler - Trigger setup

The reason we get this error is becuase when you setup a trigger and not change its Start time or Expire time, the task scheduler creates it with milliseconds included, you can see that when you export the task to an XML. You will find that after you make any change to the start time and expire time (if it exists) and then export the to XML the milliseconds part is gone. Task Scheduler - XML Export

To me it seems that when we run the "schtasks /change" command it validates the existing start time and expire time format before applying any change and it fails with this error which is definitely not very descriptive or accurate.

So, the solution is just make a small change to the times (you can change it back to original value) and then run the same command and it should work fine.

This error occurs only in Windows 7 / Windows Server 2008 R2 or earlier versions of OS.

The reason for this error is rather strange and may be is a bug in Windows which Microsoft fixed in later OS versions or in an Update which I could not find.

Upvotes: 2

Related Questions