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
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.
Related
I'm trying to set up a scheduled task to run an application (.exe). The application, if run manually (by double-clicking), would check a folder for new files, process them, and exit.
However, if the application is set up as an "action" in a scheduled task, when you run the scheduled task, all you see is the application starts up and appear as a process in Task Manager, but nothing else really happens. The files in the folder are not processed at all, and the process will be stuck in Task Manager, when it should shut itself down.
Any idea what's going on there? How do I get more details on what might have happened in the background?
The scheduled task is set up to run "whether user is logged on or not", with administrative privileges.
I'm running Windows 7 Professional SP1.
Update:
This is the stack output from Process Explorer:
ntoskrnl.exe!memset+0x61a
ntoskrnl.exe!KeWaitForMultipleObjects+0xd52
ntoskrnl.exe!KeWaitForSingleObject+0x19f
ntoskrnl.exe!__misaligned_access+0xbd0
ntoskrnl.exe!__misaligned_access+0x186d
ntoskrnl.exe!KeWaitForMultipleObjects+0xf5d
ntoskrnl.exe!KeWaitForSingleObject+0x19f
ntoskrnl.exe!NtWaitForSingleObject+0xde
ntoskrnl.exe!KeSynchronizeExecution+0x3a23
wow64cpu.dll!TurboDispatchJumpAddressEnd+0x6c0
wow64cpu.dll!TurboDispatchJumpAddressEnd+0x4a8
wow64.dll!Wow64SystemServiceEx+0x1ce
wow64.dll!Wow64LdrpInitialize+0x42a
ntdll.dll!RtlUniform+0x6e6
ntdll.dll!EtwEventSetInformation+0x1da09
ntdll.dll!LdrInitializeThunk+0xe
ntdll.dll!ZwWaitForSingleObject+0x15
kernel32.dll!WaitForSingleObjectEx+0x43
kernel32.dll!WaitForSingleObject+0x12
jvm.dll!_JVM_FindSignal#4+0x4e1df
jvm.dll!_JVM_FindSignal#4+0x8c1b1
jvm.dll!_JVM_FindSignal#4+0x8c5e6
jvm.dll!_JVM_MonitorWait#16+0xac
there is an option called Start in (optional) while you editing Action. For me that helped, because my app required to have some additional resources and only could access them, when started in correct directory.
I have created scheduled tasks to run each day at various times in the morning, on 6 different machines, all running Windows 7 x64.
These tasks have largely worked over the last few years, but we have a persisting issue with tasks not triggering at times, and never after a restart.
Without touching the Task Scheduler application at all, restarting the machine will mean that the next time the task is meant to be triggered, it doesn't work.
Running any task manually after the restart appears to avoid the issue.
This issue exists for scheduled batch files and PowerShell scripts.
Is there a specific setting that is needed to keep the task working after a system restart, or is this a known outstanding issue?
The most recent time this happened, we have captured the history:
Error | 27/02/2017 03:15:00 | 101 | Task Start Failed
Information | 27/02/2017 03:15:00 | 107 | Task triggered on Scheduler
Result code for failure: 2147943645
Update 2017-03-01: One machine doesn't work and produces the above error, and another machine shows nothing at all. Clutching at straws about this issue here.
If I tick the box 'Run whether user is logged on or off' The task is invisible. We can't do this. Any other suggestions are welcome!
Update 2017-03-02: Ticking 'Run whether user is logged on or off' is causing no end of issues. None of our Access macros run anymore, and other 3rd party applications called from the batch don't work with numerous permission errors. This is not the solution!
This can occur if the task trigger was set to run One Time when created. It is possible to set a task to "Run as soon as possible after a scheduled start is missed". This will cause the task to re-run after a reboot if the trigger was missed. However, this does not occur if the task is set to run One Time. This behaviour is by design.
You can work around this issue by setting a time and date under the Expire option of the task. This option can be reached by opening the Properties of the task, selecting the Triggers tab, and then clicking the Edit button for the trigger in question. If a date and time are set for the Expire option, the task will attempt to refire on reboot if its previous trigger time was missed.
I suggest you to set the trigger to "At startup". After you rebooted the machine, the task should then be in the "Queued" status. This means it will run at the configured interval.
This issue got resolved by updating 2 options in tasks.
Set task to “Run as soon as possible after a scheduled start is missed” in the settings tab.
Set expiry for task in trigger tab
But if you have multiple jobs like us. updating every job manually is an tedious work.
This PowerShell script I wrote will help you with that.
For me I had to change «for a duration of..» to «Indefinitely» and had to change the «Daily» to «One time»
I have some really strange phenomena appearing on my PC, using Task Schedular.
We created a normal Task which is triggered every morning at 7 o'clock.
The interesting part is, that the history of Task Scheduler says, that it was running successfully.
But it didn't work.
I then created 2 other Scripts.
The first script is starting calc.
The second script creates a folder in c:/Temp
When starting those scripts over Explorer everything is running as expected.
But when running those scripts over task scheduler only the calc is starting and there won't be any folder in c:/Temp.
I already created a policy report, but nothing configured in the category Task Scheduler.
By the way the account configured in the Task Scheduler has local Admin right and run as batch job rights.
Thanks for your help.
Make sure to check any dependent files and permissions:
If permissions or ownership of a file changes that your task managed script depends on or uses (not necessary the one IN YOUR TASK), you need to make sure you re-sync your task to recognize those changes.
(for instance, if you've changed any permissions to C:\Temp but HAVEN'T resaved your Task...)
I've had the steps below fix issues when a script would run fine by itself, but after some change to it or a dependent file, would no longer run properly from Task Scheduler.
1) Open task schedular
2) find and double-click the troubled task like your going to edit it
3) Hit 'Ok'.
4) When prompted, enter credentials to save it. (If your credentials don't work then update them...that is a different problem)
5) try to re-run task from scheduler (r-click -> Run) then see if it works correctly.
NOTE: Just because the task successfully runs does NOT mean your script worked as it should. Check yourself to make sure the log file you want WAS created.
I have been using the at command to schedule the task
ex: at 14:45 my.bat
and i am getting the o/p on the command prompt as
"JOB ID is added"
But this command is not getting fired on the time which i have scheduled..
Can anyone please help me.......
I suspect the issue is not that the BAT file is not executing at all, but rather either or both of i) individual commands within the BAT file are failing, or ii) the output isn't getting sent to the place you're looking for it. (Things get even weirder if anything in the batch file requests input, since a) by default batch files may not be able to interact with the "console" at all and b) the system is probably unattended anyway at the time the batch file executes.) If my suspicion is right, there is no one "fix-everything" but rather a whole bunch of small fixes ...and you have to hit every one of them.
Find out the needed password to actually login as 'admin' (rather than your usual user), open a DOS box, and try to run the batch file. There should be some sort of error message that you can see. Fix that problem. Then try again ...and fix the next problem. Keep correcting problems and trying again until finally everything works.
I have a VBScript that does a number of tasks, including moving files from one place to another.
Lots of copy/move/create folder/delete folder/delete files like this
Set filesys = CreateObject("Scripting.FileSystemObject")
filesys.CopyFile "D:\Test Now\test.txt", "W:\test_2\test.txt"
I'm able to get the entire script to work when I run it manually by double clicking it and no errors come up. However, when I run it from scheduled task an error is shown "Path Not Found". I found this error by writing this error to a DB.
If
ON ERROR RESUME NEXT
is off the script is stuck in that error. With it set to on, the script would skip the operations not carry out its function.
I've quadruple checked the paths to make sure its right. Is there something I should be aware of when running scripts with scheduled tasks?
Are D:\ And W:\ local drives, or are they mapped network drives? If they're mapped, the user running the process might not have those drives available. Be sure you run the task as a privileged local account. It's also best to log in to that account and run the command manually. Once you verify that it works, then you can tighten up security if that's a concern.
This jumps to mind: enclose your paths in quotes ". One of the two has a space in it. And VBSscript certainly won't like that.
filesys.CopyFile "D:\Test Now\test.txt", "W:\test_2\test.txt"
Yup, just tested it, and that is indeed what was causing the error.
By the way, you may know this, but unless you want to enter a debugging nightmare, you shouldn't use On Error Resume Next unless you have a very specific reason to do so .
An old topic I know, but this may help someone:
My scheduled task was running under a specific user. Using the component services snap in for MMC I needed to give the user 'Launch and activation' permissions. Once this was done, the scheduled task ran correctly.