Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Task - Create to Run a Program at Startup and Log On

01 Apr 2011   #10
sygnus21

Windows 10 Pro
 
 

Quote   Quote: Originally Posted by Orbital Shark View Post
Glad you've sorted it
Thanks Jeff. It was your input that got me there. I tried to rep you but...


My System SpecsSystem Spec
.
06 Jun 2011   #11
blockie

 

Did the tutorial several times and it never worked at startup. See the two attachments. The first one, capture.jpg, has he first part of the single line dialog and capture1.jpg has the remainder. I have no idea what this means. I don't remembe having to be on an network. I don't want to be on the network when the computer starts up.
Incidentally, if I RUN the task from the Task Scheduler it executes the program without the UAC. Like it should.


Attached Thumbnails
Task - Create to Run a Program at Startup and Log On-capture.jpg  
Attached Images
Task - Create to Run a Program at Startup and Log On-capture1.jpg 
My System SpecsSystem Spec
06 Jun 2011   #12
Brink

64-bit Windows 10 Pro
 
 

Mariner,

Could you just run the task from Task Scheduler if it works that way?
My System SpecsSystem Spec
07 Jun 2011   #13
blockie

 

yeah, I can do that. I was hoping that a method could be devised that was not visible to the user because I was going to test it on my computer and install it on my brothers computer to let him know I had had an unattended remote session with his computer. There are other ways, however.
My System SpecsSystem Spec
.

01 Nov 2011   #14
myurkus

Windows 7 Ultimate x64
 
 

Thanks for this guide; I have been using this sort of method for a while now...however, in order to fully "tweak" this, I have a few questions.

For simplicity, let me hone-in on one specific example: I want to run "System Explorer" [I like this app!] at logon with administrator privileges.

However, I noticed that while running it on-demand (or via Elevated Program Shortcut without UAC Prompt - Create) it correctly runs with admin privileges. But I now think that it may NOT be running in admin-mode on start-up (but I am not sure) So...

  1. Is Step 15 really required? I never pointed my start-up task to a shortcut to another task that is setup to run in admin without a UAC prompt. Instead, I just ran this singular task directly pointed to the exe with "Run with highest privileges" selected.
  2. I actually have it set to start "On Log-on" and do not create a trigger "On Startup." I understand the fundamental differences in execution time and especially on a multi-user environment, but on a single-user machine, what [if any] end-result differences exist between the two triggers on a single user machine if one does not care at what point in the startup process the task is run? Could the reason that I am [possibly] getting away with my point 1 above because I am only doing this on logon? In addition, by your suggestion to setting it to run both on log-in and startup, isn't that redundant? (I would suppose the only reason two tasks are not created is because "Do not start a new instance" is the default for "if the task is already running.")
  3. When the process is created by the task, I noticed that the task continues running, but when I manually end the task, my process ("System Explorer") continues to run. Is there a way to end the task automatically after spawning off the process. (I did some research and I know I can set "stop the task if it runs longer than:" option, but is there a cleaner solution for this?)

Thanks much in advance for your help!
MikeY
My System SpecsSystem Spec
01 Nov 2011   #15
Brink

64-bit Windows 10 Pro
 
 

Hello MikeY,

Answers inline.



Quote   Quote: Originally Posted by myurkus View Post
Thanks for this guide; I have been using this sort of method for a while now...however, in order to fully "tweak" this, I have a few questions.

For simplicity, let me hone-in on one specific example: I want to run "System Explorer" [I like this app!] at logon with administrator privileges.

However, I noticed that while running it on-demand (or via Elevated Program Shortcut without UAC Prompt - Create) it correctly runs with admin privileges. But I now think that it may NOT be running in admin-mode on start-up (but I am not sure) So...


1. Is Step 15 really required? I never pointed my start-up task to a shortcut to another task that is setup to run in admin without a UAC prompt. Instead, I just ran this singular task directly pointed to the exe with "Run with highest privileges" selected.
If you want to run it as administrator without getting a UAC prompt, then step 15 was always required for me to have it do so.
Quote:
2. I actually have it set to start "On Log-on" and do not create a trigger "On Startup." I understand the fundamental differences in execution time and especially on a multi-user environment, but on a single-user machine, what [if any] end-result differences exist between the two triggers on a single user machine if one does not care at what point in the startup process the task is run? Could the reason that I am [possibly] getting away with my point 1 above because I am only doing this on logon? In addition, by your suggestion to setting it to run both on log-in and startup, isn't that redundant? (I would suppose the only reason two tasks are not created is because "Do not start a new instance" is the default for "if the task is already running.")
Yes, there's a difference between the two. Log on represents say when you log off, and want to log on again. It also represents when you say use "Switch User" to log on to another user accoun. At both of these times, you are not logging in at startup, so the Startup task does not apply to these situations.

If you are logging on say after a shutdown or restart, then this is when the Startup task would be applied.
Quote:
3. When the process is created by the task, I noticed that the task continues running, but when I manually end the task, my process ("System Explorer") continues to run. Is there a way to end the task automatically after spawning off the process. (I did some research and I know I can set "stop the task if it runs longer than:" option, but is there a cleaner solution for this?)

Thanks much in advance for your help!
MikeY
I'm afraid that I'm not familiar enough with how "System Explorer" runs to know if it's normal for it's process to run like that. Does closing the program as you would any other window or program not end the process shortly after?

Hope this helps some,
Shawn
My System SpecsSystem Spec
17 Nov 2011   #16
myurkus

Windows 7 Ultimate x64
 
 

Brink - Thanks much for your response.I did some more research, but I still found some problems. Let me break it down to two issues:


Issue 1: The necessity of Step 15 if you want it to run with in Admin Mode.

With another example I think I proved that this is unnecessary. I.e. as long as you have this task set to "Run with Highest Privileges" then it seems to work, there is no reason to create a second task and link to it.


For simplicity, I created a new example task: Run Administrator Cmd Prompt. I have it set to Log On of any user. (I will get to the "Startup" trigger later...)



Notice in the following image that my action directly opens up the Cmd prompt and does NOT run a shortcut to a second task that is set to run in admin mode! (This is what "Step 15" suggests one needs to do...)



This is key: To prove this works, I found an easy way to prove that this did launch in admin mode! Just use "Resource Monitor" and look at the "Elevated" column.




I also selected an elevated Cmd prompt as an example since one can see from the prompt itself that it is running in admin mode:



Anyway, although it is nit-picking, I thought this would be nice to know in order to simplify things. Basically it is just using the same trick in the "Run With Highest Privileges" (the task created in Step 15) with this task itself.


Issue 2: Log-in and Startup differences.

This presented me with more significant issues. I should have re-phrased my question: I understand the differences between "at log on" and "on startup;" however, I was attesting that setting both triggers is redundant in a simple startup.

However, I found something more interesting with this: Basically it seems the reason that one does not see two versions of the same task (since on startup the system is both starting up and logging in) is that the startup version of the task is throwing an error!

First off, to isolate issues, I have this Cmd prompt running at normal privileges. I have this one set to run “At System Startup” only. Unfortunately this one throws an error since the task is set (per your guide) to “Run only when user is logged on.” This makes sense if one thinks about it: by definition, a task running “At System Startup” tries to run before the user is logged in! See images below:





I researched “Event ID 101” and sure enough, it points to the fact that this error is caused by the task not being set to “Run whether user is logged on or not.”

Event ID 101

Anyway, I thought I should point this out. Interestingly enough when I do set it to run whether the user is logged in or not, even when running it manually, the task runs in the background and the app cannot be seen. (I see the process started in Task Manager; however, nothing appears on my computer.) However, honestly, I have spent so much time on this that I am now exhausted and I have not found a solution to this yet.

Subsequently, as far as my other concerns regarding the task still running while the app is running, I found that to be application-specific. For instance, closing the Cmd prompt correctly ends the task; however, closing apps like Process Explorer (or my original “System Explorer” task) are not coupled to the task itself. (I.e. closing the app does not end the tap. Contra-positively, ending the task does not close the app.) I wish there was an explicit setting to "run application in its own thread" or something, but I can live with these odd behaviors.

So for now, I am just following your guide, skipping Step 15 and just setting to “Run With Highest Privileges” and only using “At Log On” as a trigger.

Phew! I hope this helps…
MikeY
My System SpecsSystem Spec
17 Nov 2011   #17
Brink

64-bit Windows 10 Pro
 
 

Hello Mike,

I have updated the tutorial to help simplify it more. The added step 18 is the key to help a elevated program to run at startup for an administrator account without a UAC prompt. Please see how that works for you now.
My System SpecsSystem Spec
19 Nov 2011   #18
myurkus

Windows 7 Ultimate x64
 
 

Quote   Quote: Originally Posted by Brink View Post
Hello Mike,

I have updated the tutorial to help simplify it more. The added step 18 is the key to help a elevated program to run at startup for an administrator account without a UAC prompt. Please see how that works for you now.
Thanks much for your response and your updates! It is great to know that my tests and efforts were not in vain.

I see what you are going for with Step 18. (If I understand correctly, if one sees the error I see, it will try for the next few minutes to run it after the user is logged in.) Unfortunately, at least with a task opening a Cmd prompt, once it throws that error, the task engine does not try again anymore. (I only see the same singular error in the history...) I waited a few minutes and it never tried to re-start itself in vain. I think this is only applicable only once the user is logged-in.

Personally, even if this did work, I can think of some boundary conditions that may still fail, such as what if it is set to retry every minute 3 times, but the user takes longer than 3 minutes to fill in the password and login?

IMHO I think the main thing is that for most tasks, the "at log on" trigger alone is sufficient (and may be the only one that works.) Only in special cases (most likely hidden actions under-the-hood) that make sense to run "On Startup."

Regardless, thank you for listening and streamlining the tutorial. For multiple reasons I find the tricks and techniques outlines to be invaluable.

MikeY
My System SpecsSystem Spec
19 Nov 2011   #19
Brink

64-bit Windows 10 Pro
 
 

Mike,

I tested the updated tutorial using System Explorer (installable version), and when I restarted the computer, it ran elevated without a UAC prompt for me without issue.

For "At startup" to work, you must also have the "At log on" (step 12) set.

I do have my Windows 7 set to log on automatically at startup as well, but that shouldn't matter.
My System SpecsSystem Spec
Reply

 Task - Create to Run a Program at Startup and Log On




Thread Tools




Similar help and support threads
Thread Forum
Task Scheduler - Create Task to Display a Message Reminder
How to Display a Message Reminder in Windows with Task Scheduler This will show you how to create yourself, or another user or group, a message reminder scheduled to display for when and how often you like in Windows 7 or Vista using Task Scheduler. All users on the computer will be able to...
Tutorials
Task Scheduler : Create Shut Down PC Automatically Task
How to Create a Task that will Shut Down the PC Automatically This will show a very easy way to create a task in the Task Scheduler that will shut down the PC whenever you like. This will work for Windows 7 and Windows Vista. Let's get started! 1) In the Windows start menu search box type...
Tutorials
Task Scheduler - Create New Task
How to Create Automated Task that Runs at Set Time in Windows 7 A very handy feature within Vista, Windows Server 2008 & now Windows 7 is the Task Scheduler. This app will allow the automated running of files and programs at a user designated time. Here's How: 1. Open up Task...
Tutorials
create sleep task, to force sleep over a program ?
Hello, I would like to know how to create a task in task scheduler , that'll force the computer into sleep over a running program. Basically, I have some software that runs in the background called 'WD anywhere backup' and when this software is running it prevents the computer from...
General Discussion
Can't create a task in task scheduler, account unknown.
"Task scheduler cannot create the task. The user account is unknown, the password is incorrect, or the user account does not have permission to create this task." I'm getting that message. I read you needed a passworded account to create a task, so I made a new account because I didn't want a...
General Discussion
Task scheduler unable to load task status/active tasks at startup.
My task manager is unable to load task status/active tasks at startup. I get the message: "The selected task "{0}" no longer exists. To see the current tasks, click Refresh." When I refresh I get the same message. I checked and found that under Microsoft the problem was in the defrag...
Performance & Maintenance


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 11:27.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App