none
Scheduling a Visual Studio Deployed Applicaton

    Question

  • I have created a Foreground app on my Raspberry Pi using Visual Studio 2019 deployment from my workstation. I can run this app successfully from the Apps Manager on the Windows Device Portal.

    I now wish to run this program (test.exe) every 5 minutes and have entered the following command using Powershell:

    schtasks /create /SC MINUTE /MO 5 /TN test /TR test

    The scheduled task is created, but does not run

    I have also tried:

    schtasks /create /SC MINUTE /MO 5 /TN test /TR test.exe

    with the same result, and have tracked down the full file spec of the app and tried that, also without success.

    Any suggestions? Does the fact that this is a Foreground task make any difference?

    Tuesday, June 11, 2019 3:26 PM

Answers

  • Hi Michael,

    I have changed the instruction (From "add" to "run")  to:

    schtasks /create /tn test /sc minute /mo 1 /tr "iotstartup run 2866b452-2ce1-4c6c-bb00-ad9deaa184c0_bc4pd94yyxh92!App"

    and its now correctly scheduling the App every minute. (I also had the wong App!)

    Thanks for your help

    Peter

    • Marked as answer by lankylad Thursday, June 13, 2019 6:57 AM
    Wednesday, June 12, 2019 12:48 PM

All replies

  • Hello lankylad,

    If you want to run the foreground app via command, you need to use IotStartup. By default, the app installed on Windows IoT Core is running with DefaultAccount, so you also need to create the task with DefaultAccount.(If you run the command via powershell or SSH connection as administrator, it will show the error "ERROR: failed to activate".)

    Please try to run the following command in Device Portal->Process->Run Command.

    schtasks /create /tn test /sc minute /mo 1 /tr "IotStartup add headed {your app family id}"

    BTW, Windows IoT Core build 17763.503 supports "IotStartup run MyApp" command to start  app identified by MyApp.

    You can get the app family id by running command IotStartup list.

    Best Regards,

    Michael


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.




    Wednesday, June 12, 2019 2:49 AM
  • Thanks Michael, I have followed your instructions with "Run as DefaultAccount" ticked but the task is still not starting.

    schtasks /create /tn test /sc minute /mo 1 /tr "iotstartup add headed IoTOnboardingTask-uwp_1w720vyc4ccym!App"

    I have also tried to run the task directly with

    schtasks /run /tn test

    All the messages say that everything has succeeded, but the task still doesnt start.

    It does start if I choose "Start" from the dropdown list against the App on Apps Manager

    Wednesday, June 12, 2019 9:58 AM
  • Hi Michael,

    I have changed the instruction (From "add" to "run")  to:

    schtasks /create /tn test /sc minute /mo 1 /tr "iotstartup run 2866b452-2ce1-4c6c-bb00-ad9deaa184c0_bc4pd94yyxh92!App"

    and its now correctly scheduling the App every minute. (I also had the wong App!)

    Thanks for your help

    Peter

    • Marked as answer by lankylad Thursday, June 13, 2019 6:57 AM
    Wednesday, June 12, 2019 12:48 PM
  • Hello lankylad,

    Despite the task/command you are going to run(as param value of /tr) is incorrect, the schtasks can create the task successfully, so you will not get error message about the target running task. 

    iotstartup run is new in build 17763.503, the document has not been updated. You can use iotstartup -h to see the command usage.

    Best Regards,

    Michael


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, June 13, 2019 1:30 AM