remote access - Unable to remotely schedule tasks from the command line

08
2014-06
  • Eptin

    I'm on a Windows 7 machine, attempting to use the command line to schedule a task on another Windows 7 machine in my company's network. I have administrative-level credentials for both computers. With help from http://msdn.microsoft.com/en-us/library/windows/desktop/bb736357.aspx I have created this line to run on the command prompt:

    schtasks /Create /S machinename /U username /P password /SC ONCE /TN Test1 /TR C:\Windows\System32\calc.exe /ST 16:30
    

    Whenever I launch that, I get the following error:

    ERROR: User credentials are not allowed on the local machine.
    

    How can I fix this?

  • Answers
  • Eptin

    Here is the correct syntax:

    schtasks /Create /S machinename /RU domain\username /RP password /SC ONCE /TN Test1 /TR C:\Windows\System32\calc.exe /ST 16:30
    

    Note the /RU and the /RP where /U and /P used to be. We are using RU for "Run as User".
    Also note that we must specify the domain that we are logging onto.

    This was answered by Aseem Kishore and Brian Gibson here: http://thebackroomtech.com/2009/04/06/windows-2008-schtasks-error-user-credentials-are-not-allowed-on-the-local-machine/ via http://brianagibson.blogspot.com/2008/08/hmc-45-domaincachetask-scheduled-task.html


  • Related Question

    windows - Creating scheduled tasks from command line (using parameters)
  • Questioner

    I am trying to create a scheduled task from command line, although I can create in fine when defining the executable, I have problems when trying to add a parameter for that executable:

    schtasks /Create /SC DAILY /TN TestRun /TR "C:\Program Files\Test\test.exe" C:\
    

    I am effectively trying to launch "test.exe C:\"


  • Related Answers
  • Anton Semenov
    schtasks /Create /SC DAILY /TN TestRun /TR "'C:\Program Files\Test\test.exe' 'C:\'"
    

    You can read details in help:

    schtasks /Create /?