locked
How to create a task in command line with "Run whether user is logged on or not” option? RRS feed

  • Question

  • Hello everyone,

    I am trying to write a script that would create a task through command line with the option of "Run whether user is logged on or not”.

    This option seems to be only available when the task is created interactively on the Task Scheduler.

    Anyone? Any Idea?

    Thank you!

    Cheers,

    Samuel Lee

    • Moved by Jie Bao Tuesday, July 24, 2012 8:57 AM (From:Visual Basic General)
    Wednesday, July 11, 2012 10:02 AM

All replies

  • This is not a script forum. If you're using VB.Net, have a look at the process class to start an an application with arguments. As to which arguments to pass, this is beyond the scope of this forum. Have a look at the documentation of the started application.

    Armin

    Wednesday, July 11, 2012 11:03 AM
  • Not sure if you are are running the script through a Visual Basic .NET (Shell or Process.Start) app but if you are using Schtasks to create the task then I believe that option is the default:

    Schtasks /Create /TN Taskname /TR appname.exe /sc DAILY /ST 10:00 /RU system 


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Wednesday, July 11, 2012 1:02 PM
  • My apologies, I currently do not know where else to post my answer on MS forum to ask my question. Care to share the direction? =) Thank you!

    Cheers,

    Samuel

    Friday, July 13, 2012 2:50 AM
  • Thanks Paul. But I am still facing the issue where the task doesn't run till the user logs on.

    Cheers,

    Samuel

    Friday, July 13, 2012 2:52 AM
  • My apologies, I currently do not know where else to post my answer on MS forum to ask my question. Care to share the direction? =) Thank you!

    I'd ask in one of these sub forums: http://answers.microsoft.com/en-us/windows/forum/windows_7

    Armin

    Friday, July 13, 2012 11:28 AM
  • Does it work if you use the Task Scheduler UI and select the same settings as Schtasks?

    Paul ~~~~ Microsoft MVP (Visual Basic)

    Friday, July 13, 2012 11:57 AM