Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7759267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:35:06+00:00 2026-06-01T13:35:06+00:00

I am trying to schedule the tasks from my application using schtasks instead of

  • 0

I am trying to schedule the tasks from my application using schtasks instead of using the Windows Task Scheduler COM/managed API.
Creating a task here is easier by using this on command line schtasks /Create /tn "MyApp" /tr c:\myapp.exe /sc onlogon but I opened the command line as an administrator to get the task created (otherwise I get access denied)

From my application, to create the task I use

string args = @"/Create /tn MyApp /tr c:\myapp.exe /sc onlogon";
Process.Start("schtasks", args);

However, the task gets created only if I run my application as an administrator. I need to avoid this, so that any user can create the task without the hassle of running the app as admin. Any suggestions on how ca this be done?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T13:35:09+00:00Added an answer on June 1, 2026 at 1:35 pm

    You can try with a sort of RunAs that allow to run a process with a specified user :

        ProcessStartInfo psi = new ProcessStartInfo("schtasks");
        psi.UseShellExecute = false;
        psi.UserName = "Username";
        psi.Password = "password";
    
        Process.Start(psi);
    

    The Process class through ProcessStartInfo provides a mechanism which allows you to specify the user context that the new process should run under, so you can specify the user in which you want to run the command even if the user that start the program is different. In your case you can specify Administrator credentials to the ProcessStartInfo without having to run the program with an Administrator user …

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add a new task to the Windows Tasks Scheduler with schtasks.exe
I'm trying to script windows scheduled task creation with powershell, where the schedules tasks
trying to run a simple batch file in windows 2008 task scheduler call cleanup.bat
I'm trying to use a timer to schedule a recurring event in an application.
I am trying to develop a scheduler- and calendar-dependent event application in C#, for
I'm trying to run Watin from within a TeamCity build, using nUnit. All tests
I am trying to auto email a report from access using VBA in a
I'm trying to find a way to schedule Tasks to run in sequence. The
I'm trying to run the Fair Scheduler, but it's not assigning Map tasks to
Possible Duplicates: windows service vs scheduled task Windows Service Vs Simple Program I'm trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.