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

Page 2 of 7 FirstFirst 1234 ... LastLast

  1. Posts : 7,683
    Windows 10 Pro
       #10

    Orbital Shark said:
    Glad you've sorted it :)
    Thanks Jeff. It was your input that got me there. I tried to rep you but...
      My Computer


  2. Posts : 605
    W7 Ultimate
       #11

    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 Attached Thumbnails Task - Create to Run a Program at Startup and Log On-capture.jpg   Task - Create to Run a Program at Startup and Log On-capture1.jpg  
      My Computer


  3. Posts : 71,977
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #12

    Mariner,

    Could you just run the task from Task Scheduler if it works that way?
    Last edited by Brink; 06 Jun 2011 at 13:55.
      My Computer


  4. Posts : 605
    W7 Ultimate
       #13

    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 Computer


  5. Posts : 6
    Windows 7 Ultimate x64
       #14

    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 Computer


  6. Posts : 71,977
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #15

    Hello MikeY,

    Answers inline. :)



    myurkus said:
    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.
    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.
    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 Computer


  7. Posts : 6
    Windows 7 Ultimate x64
       #16

    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 Computer


  8. Posts : 71,977
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #17

    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 Computer


  9. Posts : 6
    Windows 7 Ultimate x64
       #18

    Brink said:
    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 Computer


  10. Posts : 71,977
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #19

    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 Computer


 
Page 2 of 7 FirstFirst 1234 ... LastLast

  Related Discussions
Our Sites
Site Links
About 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:47.
Find Us