Web lists-archives.com

Re: Can't create scheduled task over ssh as current user

On Tue, Feb 19, 2019 at 12:02 PM John Oxley wrote:

> I'm running a Windows 10 VM with a fairly recent installation of Cygwin (last month or so).
> If I ssh into the box as the user "foo", I cannot create a scheduled task for the user:
> foo@host $ schtasks /create /ru foo /rp fooPassword /sc HOURLY /tn foobar /tr 'echo foo'
> ERROR: The user name or password is incorrect.
> If on the otherhand I log in as the user "bar" and run exactly the same command, the scheduled task is created
> bar@host $ schtasks /create /ru foo /rp fooPassword /sc HOURLY /tn foobar4 /tr 'echo foo'
> SUCCESS: The scheduled task "foobar4" has successfully been created.
> If I log into the VM with remote desktop as the user foo, I can create the task.
> I have tried substituting /ru and /rp with /u and /p but get the error
> ERROR: User credentials are not allowed on the local machine.
> I am not sure what is going on and would love some help.

Regarding schtasks:

The /u and /p parameters mean "credentials for the user that has
permission to create a task," not "credentials for the task itself"
(credentials for the task itself are /ru and /rp). They only work for
a remote machine (/s parameter).

With that said: Why do you need to ssh to the machine to create a
task? Just create the task remotely from the machine you're on.

I'd recommend PowerShell anyway for more flexibility (New-ScheduledTask, etc.).


Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple