Is it possible to modify (or create) an scheduled task in Windows command-line to remove the need for user login?

1

2

Is it possible to change, by using command-line, this first state in my Windows Task Scheduler (sorry, my Windows is in spanish; look for translation on the bottom):

Scheduled task that needs user login to run

to this other?

Scheduled task with no need of user login to run

Only change (approximate translation):

"Run only if the user has logged in"

to

"Run even when user has not logged in"

If modification via command-line is not possible, I could workaround by creating again the task. I need to solve it for Windows 7, but could be useful for Windows XP too.

EDIT: The program executed is this "Prueba02.cmd":

echo Prueba02 >> c:\Temporal\SchedTasks\Prueba02.txt

Sopalajo de Arrierez

Posted 2014-03-15T22:07:22.527

Reputation: 5 328

Answers

1

You need to provide a user for the task to run as. For example /RU system

See schtasks /Change /? for more info, especially /RU, /RP, and /NP

adam

Posted 2014-03-15T22:07:22.527

Reputation: 549

Thanks, @adam, but what is /NP? I can not find it in the docs. – Sopalajo de Arrierez – 2014-03-15T22:39:04.297

/NP A value that indicates that no password is stored. The task does not run interactively as the given user. Only local resources are available. See: http://ss64.com/nt/schtasks.html

– adam – 2014-03-15T22:44:07.097

1

I believe so, using the Windows utility Schtasks.

Look for the parameter /RU.

/RU username

A value that specifies the user context under which the task runs. For the system account, valid values are, NT AUTHORITY\SYSTEM, or SYSTEM. For Task Scheduler 2.0 tasks, NT AUTHORITY\LOCALSERVICE, and NT AUTHORITY\NETWORKSERVICE are also valid values.

Example:

SCHTASKS /Create /TN MyTask /TR "C:\MyTask.bat" /SC ONSTART /RU SYSTEM

stderr

Posted 2014-03-15T22:07:22.527

Reputation: 9 300