How do I get my program to run different privileges when Windows 7 starts up?

I am trying to add my program to Windows 7 but it doesn't work. My program has a built in UAC manifest.

My current way is to add a string value to HKCU .. \ Run.

I found a manual solution for Vista from http://social.technet.microsoft.com/Forums/en/w7itprosecurity/thread/81c3c1f2-0169-493a-8f87-d300ea708ecf

  • Click Start, right-click Computer and select Manage.
  • Click "Task Scheduler" in the left pane.
  • Click Create Task in the right pane.
  • Enter a name for the task.
  • Check the box next to Run with highest privileges.
  • Click the "Actions" tab.
  • Click "Create ...".
  • Navigate to the program in the Program / script field. Click OK.
  • On the desktop, right-click, select New, and click Shortcut.
  • In a field like: schtasks.exe / run / tn TaskName, where TaskName is the name of the task that you put in the Basics tab and click Next.
  • Enter a name for the shortcut and click Finish.

Also, you need to run the saved scheduled task to run the program instead of running the application shortcut to ignore the IAC prompt. At startup, the system launches the program through the original shortcut. Therefore, you need to change the location to run the saved task. You are welcome:

  • Open Regedit.
  • Find the startup item entry in the registry. It will be stored in one of the following branches.
    • HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Run
    • HKEY_USERS.DEFAULT \ Software \ Microsoft \ Windows \ CurrentVersion \ Run
    • HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Run
  • Double click on the correct key, change the path to the saved scheduled task you created.

Is there any free code to add a privileged item to a scheduled job? I didn't find a free one at torry.net.

Many thanks.

+2


a source to share


4 answers


There is a COM component called TaskScheduler. Some documentation is at http://msdn.microsoft.com/en-us/library/aa384006(v=VS.85).aspx . An example in C # is included in the Windows 7 Learning Kit.



+2


a source


The JCL provides a Delphi interface for managing the Microsoft Task Scheduler service. Its name is JclTask.pas. They also provide a demo application for adding / removing / displaying Windows tasks in the "jcl \ examples \ windows \ tasks" folder.



In addition, if the commercial components are okay with you, SiComponents provides the VCL Scheduling Agent , which is a VCL wrapper for the Windows Task Scheduler and supports the new interface provided in Windows Vista.

+2


a source


Why not just add your program to the Task Scheduler? See Command Line Options for schtasks.exe on MSDN for options. Your command line might look something like this:

schtasks.exe / Create / RU {username} / RP {password} / SC ONLOGON / TN {task name} / TR {file to run} / RL HIGHEST.

"/ RL HIGHEST" is what allows the task to run with administrator-level privileges.

+1


a source


Are you asking how to launch an application (launch) on Windows 7 startup, or ask how to change application permissions on Windows 7 startup?

0


a source







All Articles