Windows 7 Cannot create task from schtasks that runs when user logged off

Discussion in 'Programming and Scripting' started by Michael Phoenix, Sep 21, 2015.

Tags:
  1. Michael Phoenix

    Michael Phoenix New Member

    Joined:
    Sep 21, 2015
    Messages:
    1
    Likes Received:
    0
    I need to be able to use the schtasks command line utility to cteate a a task theat will run even when the user is not logged on. So far I have been unable to figure out away to do that. Any help would be appreciated.

    I have tried several combinations of /RU and /RP and /u and /p without success detailed below along with the error messages that are returned:

    Various attempts:

    C:\Users\mphoenix>schtasks /create /tn test /st 18:00 /tr c:\scheduledtasks\test.bat /ru system /sc minute /mo 4 ERROR: Access is denied.

    C:\Users\mphoenix>schtasks /create /tn test /st 18:00 /tr c:\scheduledtasks\test.bat /u system /sc minute /mo 4 ERROR: Invalid syntax. Cannot specify user name without specifying system name. Type "SCHTASKS /?" for usage.

    C:\Users\mphoenix>schtasks /create /tn test /st 18:00 /tr c:\scheduledtasks\test .bat /u [my username] /p [my user password] /sc minute /mo 4 /NP ERROR: Invalid syntax. Cannot specify user name without specifying system name. Type "SCHTASKS /?" for usage.

    C:\Users\mphoenix>schtasks /create /tn test /st 18:00 /tr c:\scheduledtasks\test.bat /ru system /sc minute /mo 4 /rp ERROR: Access is denied.

    C:\Users\mphoenix>schtasks /create /tn test /st 18:00 /tr c:\scheduledtasks\test.bat /ru SYSTEM /sc minute /mo 4 /rp ERROR: Access is denied.

    C:\Users\mphoenix>schtasks /create /tn test /st 18:00 /tr c:\scheduledtasks\test.bat /ru /sc minute /mo 4 /rp ERROR: Invalid syntax. Value expected for '/ru'. Type "SCHTASKS /CREATE /?" for usage.

    C:\Users\mphoenix>schtasks /create /tn test /st 18:00 /tr c:\scheduledtasks\test.bat /ru /sc minute /mo 4 /rp ! ERROR: Invalid syntax. Value expected for '/ru'. Type "SCHTASKS /CREATE /?" for usage.

    C:\Users\mphoenix>schtasks /create /tn test /st 18:00 /tr c:\scheduledtasks\test.bat /ru /sc minute /mo 4 /rp * ERROR: Invalid syntax. Value expected for '/ru'. Type "SCHTASKS /CREATE /?" for usage.

    C:\Users\mphoenix>schtasks /create /tn test /st 18:00 /tr c:\scheduledtasks\test.bat /ru /sc minute /mo 4 /rp "*" ERROR: Invalid syntax. Value expected for '/ru'. Type "SCHTASKS /CREATE /?" for usage.

    Exactly what am I missing here? I thought with /RU SYSTEM that you only need /RP to have no value or be "*".
     
  2. ussnorway

    ussnorway Windows Forum Team
    Staff Member Premium Supporter

    Joined:
    May 22, 2012
    Messages:
    2,541
    Likes Received:
    318
    You cann't run a task at the user level in w7 unless that user is logged on.

    In windows 8.1/ 10 or server12r2 you could use an 'Enhanced session' to remotely run a task without the user being logged in, assuming you have set the hyper-v hypervisor to allow that and have admin rights but I'm not sure if that helps because you havn't told us why you need to do this or what the task is.
     

Share This Page

Loading...