Web lists-archives.com

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




________________________________
From: cygwin-owner@xxxxxxxxxx <cygwin-owner@xxxxxxxxxx> on behalf of Bill Stewart <bstewart@xxxxxxxxx>
Sent: 19 February 2019 19:15
To: cygwin@xxxxxxxxxx
Subject: 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.

> 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).
Yeah, I figured that out.  I was trying to use "/s hostname /u foo /p fooPassword" to try and force a remote setup.

> 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.
In this case I am on a Linux machine.  I have a lot of automation setup from Linux boxes to manage the Windows VMs.

> I'd recommend PowerShell anyway for more flexibility (New-ScheduledTask, etc.).
I started off with PowerShell but re-wrote to schtasks to make this post shorter.  Exactly the same thing happens:

> Register-ScheduledTask -TaskName $taskName -Action $action -Trigger $trigger -RunLevel Highest -User foo -Password $fooPassword
Register-ScheduledTask : The user name or password is incorrect.
At line:1 char:1
+ Register-ScheduledTask -TaskName $taskName -Action $action -Trigger $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : AuthenticationError: (PS_ScheduledTask:Root/Microsoft/...S_ScheduledTask) [Register-Schedule
   dTask], CimException
    + FullyQualifiedErrorId : HRESULT 0x8007052e,Register-ScheduledTask


--
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