How to list scheduled tasks in C#










6















Before anyone says this is a duplicate, I already checked here, here, here, here, and a couple of other resources, including MS Task Scheduler Class documentation.



I wanted to be able to list the scheduled tasks on my servers using a C# program I´m developing. Some suggested schtasks.exe MS program, others a third-party library, which seems old and working only with .NET Framework 2.0 and others the MS Task Scheduler Class, which seems to be protected and I´m yet to see some example so I understand how I can use it, and others suggested even reading the XML files in each remote machine under C:WindowsSystem32Tasks folder.



My question is: are tasks in Windows that hard to work with using some VS built-in class? Do I have to jump through hoops in order to do something (kind of) silly like listing the tasks already scheduled in a machine?



Thank you,



EDIT:



I ended up using Process class and started schtasks.exe against all servers. Not exactly what I was looking for but it works. If anyone needs the code, just drop me a line and I post it here. Thanks.










share|improve this question



















  • 1





    What does "seems to be protected" mean in the context of the MS Task Scheduler Class?

    – Jim Mischel
    Dec 28 '16 at 17:31











  • @JimMischel, in [MS documentation] (msdn.microsoft.com/en-us/library/…) it says the constructor is protected.

    – Adriano_epifas
    Dec 28 '16 at 18:45






  • 1





    Yes, but TaskScheduler.Current is static and public, as is TaskScheduler.Default. The constructor is intended to be used only by derived classes. In any case, that class does not appear to be an interface to the operating system's list of scheduled tasks.

    – Jim Mischel
    Dec 28 '16 at 19:19















6















Before anyone says this is a duplicate, I already checked here, here, here, here, and a couple of other resources, including MS Task Scheduler Class documentation.



I wanted to be able to list the scheduled tasks on my servers using a C# program I´m developing. Some suggested schtasks.exe MS program, others a third-party library, which seems old and working only with .NET Framework 2.0 and others the MS Task Scheduler Class, which seems to be protected and I´m yet to see some example so I understand how I can use it, and others suggested even reading the XML files in each remote machine under C:WindowsSystem32Tasks folder.



My question is: are tasks in Windows that hard to work with using some VS built-in class? Do I have to jump through hoops in order to do something (kind of) silly like listing the tasks already scheduled in a machine?



Thank you,



EDIT:



I ended up using Process class and started schtasks.exe against all servers. Not exactly what I was looking for but it works. If anyone needs the code, just drop me a line and I post it here. Thanks.










share|improve this question



















  • 1





    What does "seems to be protected" mean in the context of the MS Task Scheduler Class?

    – Jim Mischel
    Dec 28 '16 at 17:31











  • @JimMischel, in [MS documentation] (msdn.microsoft.com/en-us/library/…) it says the constructor is protected.

    – Adriano_epifas
    Dec 28 '16 at 18:45






  • 1





    Yes, but TaskScheduler.Current is static and public, as is TaskScheduler.Default. The constructor is intended to be used only by derived classes. In any case, that class does not appear to be an interface to the operating system's list of scheduled tasks.

    – Jim Mischel
    Dec 28 '16 at 19:19













6












6








6








Before anyone says this is a duplicate, I already checked here, here, here, here, and a couple of other resources, including MS Task Scheduler Class documentation.



I wanted to be able to list the scheduled tasks on my servers using a C# program I´m developing. Some suggested schtasks.exe MS program, others a third-party library, which seems old and working only with .NET Framework 2.0 and others the MS Task Scheduler Class, which seems to be protected and I´m yet to see some example so I understand how I can use it, and others suggested even reading the XML files in each remote machine under C:WindowsSystem32Tasks folder.



My question is: are tasks in Windows that hard to work with using some VS built-in class? Do I have to jump through hoops in order to do something (kind of) silly like listing the tasks already scheduled in a machine?



Thank you,



EDIT:



I ended up using Process class and started schtasks.exe against all servers. Not exactly what I was looking for but it works. If anyone needs the code, just drop me a line and I post it here. Thanks.










share|improve this question
















Before anyone says this is a duplicate, I already checked here, here, here, here, and a couple of other resources, including MS Task Scheduler Class documentation.



I wanted to be able to list the scheduled tasks on my servers using a C# program I´m developing. Some suggested schtasks.exe MS program, others a third-party library, which seems old and working only with .NET Framework 2.0 and others the MS Task Scheduler Class, which seems to be protected and I´m yet to see some example so I understand how I can use it, and others suggested even reading the XML files in each remote machine under C:WindowsSystem32Tasks folder.



My question is: are tasks in Windows that hard to work with using some VS built-in class? Do I have to jump through hoops in order to do something (kind of) silly like listing the tasks already scheduled in a machine?



Thank you,



EDIT:



I ended up using Process class and started schtasks.exe against all servers. Not exactly what I was looking for but it works. If anyone needs the code, just drop me a line and I post it here. Thanks.







c# .net task scheduled-tasks






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 23 '17 at 12:16









Community

11




11










asked Dec 28 '16 at 16:25









Adriano_epifasAdriano_epifas

187112




187112







  • 1





    What does "seems to be protected" mean in the context of the MS Task Scheduler Class?

    – Jim Mischel
    Dec 28 '16 at 17:31











  • @JimMischel, in [MS documentation] (msdn.microsoft.com/en-us/library/…) it says the constructor is protected.

    – Adriano_epifas
    Dec 28 '16 at 18:45






  • 1





    Yes, but TaskScheduler.Current is static and public, as is TaskScheduler.Default. The constructor is intended to be used only by derived classes. In any case, that class does not appear to be an interface to the operating system's list of scheduled tasks.

    – Jim Mischel
    Dec 28 '16 at 19:19












  • 1





    What does "seems to be protected" mean in the context of the MS Task Scheduler Class?

    – Jim Mischel
    Dec 28 '16 at 17:31











  • @JimMischel, in [MS documentation] (msdn.microsoft.com/en-us/library/…) it says the constructor is protected.

    – Adriano_epifas
    Dec 28 '16 at 18:45






  • 1





    Yes, but TaskScheduler.Current is static and public, as is TaskScheduler.Default. The constructor is intended to be used only by derived classes. In any case, that class does not appear to be an interface to the operating system's list of scheduled tasks.

    – Jim Mischel
    Dec 28 '16 at 19:19







1




1





What does "seems to be protected" mean in the context of the MS Task Scheduler Class?

– Jim Mischel
Dec 28 '16 at 17:31





What does "seems to be protected" mean in the context of the MS Task Scheduler Class?

– Jim Mischel
Dec 28 '16 at 17:31













@JimMischel, in [MS documentation] (msdn.microsoft.com/en-us/library/…) it says the constructor is protected.

– Adriano_epifas
Dec 28 '16 at 18:45





@JimMischel, in [MS documentation] (msdn.microsoft.com/en-us/library/…) it says the constructor is protected.

– Adriano_epifas
Dec 28 '16 at 18:45




1




1





Yes, but TaskScheduler.Current is static and public, as is TaskScheduler.Default. The constructor is intended to be used only by derived classes. In any case, that class does not appear to be an interface to the operating system's list of scheduled tasks.

– Jim Mischel
Dec 28 '16 at 19:19





Yes, but TaskScheduler.Current is static and public, as is TaskScheduler.Default. The constructor is intended to be used only by derived classes. In any case, that class does not appear to be an interface to the operating system's list of scheduled tasks.

– Jim Mischel
Dec 28 '16 at 19:19












3 Answers
3






active

oldest

votes


















5














Ah, System.Threading.TaskScheduler is for scheduling work units within a process, not related to the scheduled tasks that you can create from the administrative tools.



I would use a library like https://taskscheduler.codeplex.com/ - Googled to find, I do something similar with an awful COM wrapper from 2004 that I've been meaning to update. It makes it pretty easy to see what's in the scheduled tasks.



E.g. from their "Enumerate all tasks" example



void EnumAllTasks()

using (TaskService ts = new TaskService())
EnumFolderTasks(ts.RootFolder);


void EnumFolderTasks(TaskFolder fld)

foreach (Task task in fld.Tasks)
ActOnTask(task);
foreach (TaskFolder sfld in fld.SubFolders)
EnumFolderTasks(sfld);


void ActOnTask(Task t)

// Do something interesting here






share|improve this answer






























    3














    In Visual Studio add the reference in COMType Libraries: TaskScheduler



    and use the Taskschd API:
    https://docs.microsoft.com/en-us/windows/desktop/api/taskschd



    This is an example of the way I'm doing it:



    You retrieve the tasks at which you have access permissions, depending if you're running the code with a local or admin account.



    My solution was doing this in a Windows Service with Local System account that runs in our servers.



    using TaskScheduler;

    void ProcessTaskFoler (ITaskFolder taskFolder)

    int idx;
    string name, path;
    _TASK_STATE state;

    IRegisteredTaskCollection taskCol = taskFolder.GetTasks((int)_TASK_ENUM_FLAGS.TASK_ENUM_HIDDEN); // include hidden tasks, otherwise 0
    for (idx = 1; idx <= taskCol.Count; idx++) // browse al tasks in folder

    IRegisteredTask runTask = taskCol[idx]; // 1 based index

    name = runTask.Name;
    path = runTask.Path;
    state = runTask.State;
    // retrieve other properties...

    Console.WriteLine(path);


    ITaskFolderCollection taskFolderCol = taskFolder.GetFolders(0); // 0 = reserved for future use
    for (idx = 1; idx <= taskFolderCol.Count; idx++) // recursively browse subfolders
    ProcessTaskFoler(taskFolderCol[idx]); // 1 based index


    void ParseScheduleTasks()

    ITaskService taskService = new TaskScheduler.TaskScheduler();
    taskService.Connect();

    ProcessTaskFoler(taskService.GetFolder("\"));






    share|improve this answer
































      1














      Why not use powershell inside of your C# code? Reference this for implementing powershell in your application.



      And for finding scheduled tasks on a PC/server using powershell, here's the link to do that.



      Combine both of them along with reading the powershell output in your C# app, and Voila.






      share|improve this answer























      • I will end up trying this Ryan, thank you.

        – Adriano_epifas
        Dec 28 '16 at 18:46











      • I just checked and apparently PowerShell Get-ScheduledTask and Get-ScheduledTaskInfo cmdlets can´t retrieve the "Run as user" field I was looking for. Maybe I will have to resort to schtask.exe

        – Adriano_epifas
        Dec 28 '16 at 19:41










      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f41366002%2fhow-to-list-scheduled-tasks-in-c-sharp%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      5














      Ah, System.Threading.TaskScheduler is for scheduling work units within a process, not related to the scheduled tasks that you can create from the administrative tools.



      I would use a library like https://taskscheduler.codeplex.com/ - Googled to find, I do something similar with an awful COM wrapper from 2004 that I've been meaning to update. It makes it pretty easy to see what's in the scheduled tasks.



      E.g. from their "Enumerate all tasks" example



      void EnumAllTasks()

      using (TaskService ts = new TaskService())
      EnumFolderTasks(ts.RootFolder);


      void EnumFolderTasks(TaskFolder fld)

      foreach (Task task in fld.Tasks)
      ActOnTask(task);
      foreach (TaskFolder sfld in fld.SubFolders)
      EnumFolderTasks(sfld);


      void ActOnTask(Task t)

      // Do something interesting here






      share|improve this answer



























        5














        Ah, System.Threading.TaskScheduler is for scheduling work units within a process, not related to the scheduled tasks that you can create from the administrative tools.



        I would use a library like https://taskscheduler.codeplex.com/ - Googled to find, I do something similar with an awful COM wrapper from 2004 that I've been meaning to update. It makes it pretty easy to see what's in the scheduled tasks.



        E.g. from their "Enumerate all tasks" example



        void EnumAllTasks()

        using (TaskService ts = new TaskService())
        EnumFolderTasks(ts.RootFolder);


        void EnumFolderTasks(TaskFolder fld)

        foreach (Task task in fld.Tasks)
        ActOnTask(task);
        foreach (TaskFolder sfld in fld.SubFolders)
        EnumFolderTasks(sfld);


        void ActOnTask(Task t)

        // Do something interesting here






        share|improve this answer

























          5












          5








          5







          Ah, System.Threading.TaskScheduler is for scheduling work units within a process, not related to the scheduled tasks that you can create from the administrative tools.



          I would use a library like https://taskscheduler.codeplex.com/ - Googled to find, I do something similar with an awful COM wrapper from 2004 that I've been meaning to update. It makes it pretty easy to see what's in the scheduled tasks.



          E.g. from their "Enumerate all tasks" example



          void EnumAllTasks()

          using (TaskService ts = new TaskService())
          EnumFolderTasks(ts.RootFolder);


          void EnumFolderTasks(TaskFolder fld)

          foreach (Task task in fld.Tasks)
          ActOnTask(task);
          foreach (TaskFolder sfld in fld.SubFolders)
          EnumFolderTasks(sfld);


          void ActOnTask(Task t)

          // Do something interesting here






          share|improve this answer













          Ah, System.Threading.TaskScheduler is for scheduling work units within a process, not related to the scheduled tasks that you can create from the administrative tools.



          I would use a library like https://taskscheduler.codeplex.com/ - Googled to find, I do something similar with an awful COM wrapper from 2004 that I've been meaning to update. It makes it pretty easy to see what's in the scheduled tasks.



          E.g. from their "Enumerate all tasks" example



          void EnumAllTasks()

          using (TaskService ts = new TaskService())
          EnumFolderTasks(ts.RootFolder);


          void EnumFolderTasks(TaskFolder fld)

          foreach (Task task in fld.Tasks)
          ActOnTask(task);
          foreach (TaskFolder sfld in fld.SubFolders)
          EnumFolderTasks(sfld);


          void ActOnTask(Task t)

          // Do something interesting here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 29 '16 at 22:29









          dsolimanodsolimano

          7,36533856




          7,36533856























              3














              In Visual Studio add the reference in COMType Libraries: TaskScheduler



              and use the Taskschd API:
              https://docs.microsoft.com/en-us/windows/desktop/api/taskschd



              This is an example of the way I'm doing it:



              You retrieve the tasks at which you have access permissions, depending if you're running the code with a local or admin account.



              My solution was doing this in a Windows Service with Local System account that runs in our servers.



              using TaskScheduler;

              void ProcessTaskFoler (ITaskFolder taskFolder)

              int idx;
              string name, path;
              _TASK_STATE state;

              IRegisteredTaskCollection taskCol = taskFolder.GetTasks((int)_TASK_ENUM_FLAGS.TASK_ENUM_HIDDEN); // include hidden tasks, otherwise 0
              for (idx = 1; idx <= taskCol.Count; idx++) // browse al tasks in folder

              IRegisteredTask runTask = taskCol[idx]; // 1 based index

              name = runTask.Name;
              path = runTask.Path;
              state = runTask.State;
              // retrieve other properties...

              Console.WriteLine(path);


              ITaskFolderCollection taskFolderCol = taskFolder.GetFolders(0); // 0 = reserved for future use
              for (idx = 1; idx <= taskFolderCol.Count; idx++) // recursively browse subfolders
              ProcessTaskFoler(taskFolderCol[idx]); // 1 based index


              void ParseScheduleTasks()

              ITaskService taskService = new TaskScheduler.TaskScheduler();
              taskService.Connect();

              ProcessTaskFoler(taskService.GetFolder("\"));






              share|improve this answer





























                3














                In Visual Studio add the reference in COMType Libraries: TaskScheduler



                and use the Taskschd API:
                https://docs.microsoft.com/en-us/windows/desktop/api/taskschd



                This is an example of the way I'm doing it:



                You retrieve the tasks at which you have access permissions, depending if you're running the code with a local or admin account.



                My solution was doing this in a Windows Service with Local System account that runs in our servers.



                using TaskScheduler;

                void ProcessTaskFoler (ITaskFolder taskFolder)

                int idx;
                string name, path;
                _TASK_STATE state;

                IRegisteredTaskCollection taskCol = taskFolder.GetTasks((int)_TASK_ENUM_FLAGS.TASK_ENUM_HIDDEN); // include hidden tasks, otherwise 0
                for (idx = 1; idx <= taskCol.Count; idx++) // browse al tasks in folder

                IRegisteredTask runTask = taskCol[idx]; // 1 based index

                name = runTask.Name;
                path = runTask.Path;
                state = runTask.State;
                // retrieve other properties...

                Console.WriteLine(path);


                ITaskFolderCollection taskFolderCol = taskFolder.GetFolders(0); // 0 = reserved for future use
                for (idx = 1; idx <= taskFolderCol.Count; idx++) // recursively browse subfolders
                ProcessTaskFoler(taskFolderCol[idx]); // 1 based index


                void ParseScheduleTasks()

                ITaskService taskService = new TaskScheduler.TaskScheduler();
                taskService.Connect();

                ProcessTaskFoler(taskService.GetFolder("\"));






                share|improve this answer



























                  3












                  3








                  3







                  In Visual Studio add the reference in COMType Libraries: TaskScheduler



                  and use the Taskschd API:
                  https://docs.microsoft.com/en-us/windows/desktop/api/taskschd



                  This is an example of the way I'm doing it:



                  You retrieve the tasks at which you have access permissions, depending if you're running the code with a local or admin account.



                  My solution was doing this in a Windows Service with Local System account that runs in our servers.



                  using TaskScheduler;

                  void ProcessTaskFoler (ITaskFolder taskFolder)

                  int idx;
                  string name, path;
                  _TASK_STATE state;

                  IRegisteredTaskCollection taskCol = taskFolder.GetTasks((int)_TASK_ENUM_FLAGS.TASK_ENUM_HIDDEN); // include hidden tasks, otherwise 0
                  for (idx = 1; idx <= taskCol.Count; idx++) // browse al tasks in folder

                  IRegisteredTask runTask = taskCol[idx]; // 1 based index

                  name = runTask.Name;
                  path = runTask.Path;
                  state = runTask.State;
                  // retrieve other properties...

                  Console.WriteLine(path);


                  ITaskFolderCollection taskFolderCol = taskFolder.GetFolders(0); // 0 = reserved for future use
                  for (idx = 1; idx <= taskFolderCol.Count; idx++) // recursively browse subfolders
                  ProcessTaskFoler(taskFolderCol[idx]); // 1 based index


                  void ParseScheduleTasks()

                  ITaskService taskService = new TaskScheduler.TaskScheduler();
                  taskService.Connect();

                  ProcessTaskFoler(taskService.GetFolder("\"));






                  share|improve this answer















                  In Visual Studio add the reference in COMType Libraries: TaskScheduler



                  and use the Taskschd API:
                  https://docs.microsoft.com/en-us/windows/desktop/api/taskschd



                  This is an example of the way I'm doing it:



                  You retrieve the tasks at which you have access permissions, depending if you're running the code with a local or admin account.



                  My solution was doing this in a Windows Service with Local System account that runs in our servers.



                  using TaskScheduler;

                  void ProcessTaskFoler (ITaskFolder taskFolder)

                  int idx;
                  string name, path;
                  _TASK_STATE state;

                  IRegisteredTaskCollection taskCol = taskFolder.GetTasks((int)_TASK_ENUM_FLAGS.TASK_ENUM_HIDDEN); // include hidden tasks, otherwise 0
                  for (idx = 1; idx <= taskCol.Count; idx++) // browse al tasks in folder

                  IRegisteredTask runTask = taskCol[idx]; // 1 based index

                  name = runTask.Name;
                  path = runTask.Path;
                  state = runTask.State;
                  // retrieve other properties...

                  Console.WriteLine(path);


                  ITaskFolderCollection taskFolderCol = taskFolder.GetFolders(0); // 0 = reserved for future use
                  for (idx = 1; idx <= taskFolderCol.Count; idx++) // recursively browse subfolders
                  ProcessTaskFoler(taskFolderCol[idx]); // 1 based index


                  void ParseScheduleTasks()

                  ITaskService taskService = new TaskScheduler.TaskScheduler();
                  taskService.Connect();

                  ProcessTaskFoler(taskService.GetFolder("\"));







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 16 '18 at 0:10

























                  answered Nov 15 '18 at 15:31









                  Vic_HTVic_HT

                  313




                  313





















                      1














                      Why not use powershell inside of your C# code? Reference this for implementing powershell in your application.



                      And for finding scheduled tasks on a PC/server using powershell, here's the link to do that.



                      Combine both of them along with reading the powershell output in your C# app, and Voila.






                      share|improve this answer























                      • I will end up trying this Ryan, thank you.

                        – Adriano_epifas
                        Dec 28 '16 at 18:46











                      • I just checked and apparently PowerShell Get-ScheduledTask and Get-ScheduledTaskInfo cmdlets can´t retrieve the "Run as user" field I was looking for. Maybe I will have to resort to schtask.exe

                        – Adriano_epifas
                        Dec 28 '16 at 19:41















                      1














                      Why not use powershell inside of your C# code? Reference this for implementing powershell in your application.



                      And for finding scheduled tasks on a PC/server using powershell, here's the link to do that.



                      Combine both of them along with reading the powershell output in your C# app, and Voila.






                      share|improve this answer























                      • I will end up trying this Ryan, thank you.

                        – Adriano_epifas
                        Dec 28 '16 at 18:46











                      • I just checked and apparently PowerShell Get-ScheduledTask and Get-ScheduledTaskInfo cmdlets can´t retrieve the "Run as user" field I was looking for. Maybe I will have to resort to schtask.exe

                        – Adriano_epifas
                        Dec 28 '16 at 19:41













                      1












                      1








                      1







                      Why not use powershell inside of your C# code? Reference this for implementing powershell in your application.



                      And for finding scheduled tasks on a PC/server using powershell, here's the link to do that.



                      Combine both of them along with reading the powershell output in your C# app, and Voila.






                      share|improve this answer













                      Why not use powershell inside of your C# code? Reference this for implementing powershell in your application.



                      And for finding scheduled tasks on a PC/server using powershell, here's the link to do that.



                      Combine both of them along with reading the powershell output in your C# app, and Voila.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Dec 28 '16 at 16:45









                      Ryan CRyan C

                      466314




                      466314












                      • I will end up trying this Ryan, thank you.

                        – Adriano_epifas
                        Dec 28 '16 at 18:46











                      • I just checked and apparently PowerShell Get-ScheduledTask and Get-ScheduledTaskInfo cmdlets can´t retrieve the "Run as user" field I was looking for. Maybe I will have to resort to schtask.exe

                        – Adriano_epifas
                        Dec 28 '16 at 19:41

















                      • I will end up trying this Ryan, thank you.

                        – Adriano_epifas
                        Dec 28 '16 at 18:46











                      • I just checked and apparently PowerShell Get-ScheduledTask and Get-ScheduledTaskInfo cmdlets can´t retrieve the "Run as user" field I was looking for. Maybe I will have to resort to schtask.exe

                        – Adriano_epifas
                        Dec 28 '16 at 19:41
















                      I will end up trying this Ryan, thank you.

                      – Adriano_epifas
                      Dec 28 '16 at 18:46





                      I will end up trying this Ryan, thank you.

                      – Adriano_epifas
                      Dec 28 '16 at 18:46













                      I just checked and apparently PowerShell Get-ScheduledTask and Get-ScheduledTaskInfo cmdlets can´t retrieve the "Run as user" field I was looking for. Maybe I will have to resort to schtask.exe

                      – Adriano_epifas
                      Dec 28 '16 at 19:41





                      I just checked and apparently PowerShell Get-ScheduledTask and Get-ScheduledTaskInfo cmdlets can´t retrieve the "Run as user" field I was looking for. Maybe I will have to resort to schtask.exe

                      – Adriano_epifas
                      Dec 28 '16 at 19:41

















                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f41366002%2fhow-to-list-scheduled-tasks-in-c-sharp%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      這個網誌中的熱門文章

                      How to read a connectionString WITH PROVIDER in .NET Core?

                      In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

                      Museum of Modern and Contemporary Art of Trento and Rovereto