Logon Scripts!!! I hear you yelling at me about why I am doing a tutorial about logon scripts when Group Policy Preferences is supposed to allow me to stop using my logon scripts. Well in a utopian world there would be no logon scripts to maintain however there are still some situations that you might have to execute a program at logon. One example I recently saw on the Group Policy Forums was a person who wanted a way to delay the launching of the browser so as to not add additional delay to the users logon to what was already a slow computer. Somewhat similar to the Delay Start option for services that was introduced in Windows 7.
Prerequisites: This is a Windows Vista+ configuration as Windows XP has a more limited scheduling engine. If you really want to do this via Windows XP (sucks to be you) you could run the script with some delay/timeout third party tool in it and just have it run from the users â€œStartupâ€ start menu folderâ€¦
Step 1. In a Group Policy Object (GPO) that you have targeted at all the users (or most of them) that you want the delayed start program/action to run on go to â€œUsers Configurationâ€ > â€œPreferencesâ€ > â€œScheduled Taskâ€ then go â€œActionâ€ > â€œNewâ€ > â€œScheduled Task (Windows Vista and later)â€. Then type the display name of the script in the â€œNameâ€ field (see image 1) and click on the â€œTriggersâ€ tab.
Note: In this example we are just going to be running a command prompt so the Name is â€œCMD.exeâ€.
Image 1: Scheduled Task Properties
Step 2. On the Triggers tab click the â€œNewâ€ buttonâ€. Change the â€œBegin the taskâ€ drop down option to â€œAt log onâ€ and then tick â€œDelay task for:â€ and configure the delay from the pop down menu (see image 2). Then click â€œOKâ€
Note: Unfortunately this option does not seem to be user configurable so for the use of a logon script â€œ30 secondsâ€ and â€œ1 minuteâ€ are the only practical options.
Image 2: New Trigger
Step 3. You should now have the trigger configured for your event that looks like the image below (see image 3). Now click on the â€œActionsâ€ tab.
Image 3: Configured Trigger
Step 3. In the â€œActionsâ€ tab click on the â€œNewâ€ button and then configure the action you want to take. Again in this example we are just going to be running a command prompt so configure the â€œActionâ€ to â€œStart a programâ€ (see image 4).
Note: You can also use this option to send and e-mail or even display a pop-up message to the users. Very handy if you used to use the â€œnet sendâ€ program in Windows XP before Service Pack 2 as it was disabled due to security issues.
Image 4: New Action
Step 4. Configure the â€œProgram/Scriptâ€ to run to â€œC:\Windows\system32\cmd.exeâ€ then click â€œOKâ€ (see image 5).
Image 5: New Action
Step 5. Click â€œOKâ€ (see image 6)
Image 6: Actions Tab
Now you are done. The task is scheduled and it will be pushed out to all your users at the new Group Policy refresh. (see image 7).
Note: If you don’t want this to apply to all your user accounts you can also use Group Policy Preferences targeting options to refine the targeting.
Image 7: Scheduled Tasks
Below is the view of the scheduled task as configured on the computer (see image 8,9 & 10).
Note: The settings tab are greyed out because it is being controlled by Group Policy.
Image 8: Scheduled Tasks General Tab
Image 9: Scheduled Tasks Triggers Tab
Image 10: Scheduled Tasks Actions Tab