I have a functioning command in Windows XP to schedule a task to run every minute with the Windows scheduler. It looks like this:
ASSIGN l-cmd = 'schtasks /Create /SC minute /RU "" /TN "Capture AutoSync" /TR "\"C:\Auto.lnk"'.
OS-COMMAND NO-CONSOLE VALUE(l-cmd).
On Windows 7, I get "The task XML is missing a required element or attribute."
However, the MS example (from their website) shows the following example:
SCHTASKS /Create /S system /U user /P password /RU runasuser
/RP runaspassword
/SC HOURLY /TN rtest1 /TR notepad
The only elements I am not including are the /S and /U, since these are OPTIONAL and are for running the task on another computer.
I have tried re-ordering the arguments - no luck there, either.
Anyone have any ideas on how to make this work in Windows 7?
Thanks in advance.
Comments
schtasks \create
OE 10.2B05 Linux DB Windows Clients
just change
/TR "\"C:\Auto.lnk"'.
to
/TR "C:\Auto.lnk"'.
Access is Denied
Thanks, that got me further. Now I am bumping up against an issue that I understand is common in moving schtasks to Win 7 - Access is Denied. Trying the frequently-blogged solutions, but not finding much help there.
you'll have to elevate the
you'll have to elevate the username from "" to an local admin account - for that workstation
using /RU and /RP together i.e. /RU administrator /RP adminpassword
Has to be a better way
User passwords change over time. Even though I got the task to schedule (and run), I still want to be able to do what Google and others have done in scheduling tasks in my Task Scheduler that are independent of my personal admin login. When I look at the tasks, the show as "users" or "Administrator", but neither is acceptable as a parameter for /RU.
Any ideas?
Thanks
Thanks for the quick and insightful info. You saved me hours.