5.3. Running a Task When a User Logs On
You want to run a task when a user logs on to a system.
There are four ways you can make tasks run automatically after a user logs on: the Registry, startup folders, login scripts, and Group Policy. I explain how to use login scripts in Recipe 5.4 and Group Policy in Recipe 5.5. Here, I'll describe the Registry and startup folder options.
There are four Registry keys that you can use to run tasks automatically. To use any of the keys, simply create a value entry of type REG_SZ under the key. Give the value any name you want and specify the full path to the program or script and any parameters as the value data. See Figure 5-1 for some example entries.
Figure 5-1. Sample Registry Run key values
Values defined under this key cause tasks to run for every user that logs on to the system:
Values defined under this key cause tasks to run whenever the user that is currently logged on logs on to the system:
Values defined under this key cause a task to run the next time any user logs on to the system (and not after that):
Values defined under this key cause a task to run the next time the current user logs on to the system: