Our free ServiceTray utility manages any Windows Service from a convenient tray icon. Most folks that use the software configure it to start at login by placing a shortcut in the Windows Startup Folder, but unfortunately that method is not effective on the latest versions of Windows.
Why Doesn’t the Startup Folder Work for ServiceTray?
Microsoft introduced a set of security features called User Account Control (UAC) in Windows Vista and Server 2008. The key concept behind UAC is that of “least privilege” — where all applications run with normal, non-administrative rights until someone explicitly allows elevation to the more powerful context. Yet while UAC has certainly made PCs more secure from malicious viruses and other hostile actions, it can occasionally foil legitimate use.
For example, UAC doesn’t play nicely with programs configured to start automatically when you log in. Indeed, if an application or shortcut in the startup folder requires administrative rights, Windows will not start it! Such is the case with ServiceTray, which must run as an administrator to start, stop and interrogate your Windows Service.
So how do you get ServiceTray to start when you login? We have identified a couple of solutions:
Solution #1: Disable UAC
Perhaps the simplest way to get Windows to automatically launch ServiceTray is to turn off UAC. Indeed, a quick Google search will turn up many articles showing how to disable UAC. Apparently many people have found UAC very frustrating and end up turning it off. However as this post points out there are many security implications to consider if you go that route. So caveat emptor!
Solution #2: Create an “At Login” Scheduled Task
You may have heard that the Windows Task Scheduler is the ideal choice for running background tasks at scheduled times, but did you know that it can also fire up an application on your desktop when you log in? Here is how to do that for ServiceTray:
Start Task Scheduler. This is best done by running taskschd.msc from a command prompt, or by opening the Control Panel, searching for “schedule” and clicking the Schedule tasks link.
From the Task Scheduler window, click the Create Basic Task… action on the right:
You should now be looking at the Create Basic Task Wizard window where you can enter a name for the new task we are creating. Something like “Start ServiceTray on Login” would be appropriate, but you can enter anything you like.
Click Next > to move on.
In the Trigger section, select the When I log on option and click Next >.
Next, choose the Start a program option. As usual, click Next > to proceed to the next screen.
Now it’s time to tell the Task Scheduler how to start your ServiceTray shortcut. We’ll need to find that information from the shortcut itself.
Find the shortcut you created with ServiceTray. Right-click on it and select Properties. The window that comes up should look like this:
The Target field contains the full command line used to launch SerivceTray with your selected Windows Service. From that field, copy the path to the ServiceTray executable (probably “C:\Program Files\ServiceTray\ServiceTray.exe” — don’t forget the quotes) and place it in the Switch back to the Create Basic Task Wizard’s Program/script field. Put everything else into the Add arguments (optional) area.
For example, our ServiceTray shortcut command was:
“C:\Program Files\ServiceTray\ServiceTray.exe” “Spooler” -icon 1
Here is what the Create Basic Task Wizard window looks like after that command has been entered:
Click Next > to move on.
The basic configuration is now done and you should now see a summary of the scheduled task to be created.
But before clicking the Finish button, make sure to check the Open the Properties dialog… box because we’d like to make one more modification.
And finally, in the Properties window, check the Run with highest privileges box. This magical option will ensure that ServiceTray starts with full admin rights, so that it can manage your Windows Service.
Click OK to dismiss the dialog. Please close the Task Scheduler as well as your task is now in place.
While deactivating UAC is certainly quicker and easier, we recommend going with solution #2 as it doesn’t require any compromises in security/protection.