Logon and Logoff scripts are basically the same as the Startup and Shutdown scripts, which we already discussed. The big difference is that Startup/Shutdown are computer-level policies, and perform during the operating system startup and shutdown procedures. Logon/Logoff scripts, on the other hand, are user-based policies and these scripts run when the users are logging in or logging off. The days of shutting down computers on a regular basis have gone by the wayside, so most of the time when implementing scripts that you want to run during each user session, it is smarter to implement a Logon policy than it is to configure a Startup policy. Logon and Logoff scripts will be able to follow users from computer to computer inside your domain.
The procedure to implement Logon and Logoff scripts is the same as Startup/Shutdown scripts, with two key differences being the file location for the placement of your scripts, and the settings being configured inside the User Configuration node of the GPO:
- Copy your scripts into their appropriate folder locations inside SysVol. Logon scripts go inside \<Domain>SysVol<Domain>Policies<Policy GUID>UserScriptsLogon, and Logoff scripts should go in \<Domain>SysVol<Domain>Policies<Policy GUID>UserScriptsLogoff.
Remember that if these folder locations don't exist or if you aren't sure of the GPO's GUID, simply jump ahead to Step 2 and use that Show Files... button to open the exact location where you need to place your Logon or Logoff script.
- Edit the GPO inside which you plan to deploy this script setting, and navigate to User Configuration | Policies | Windows Settings | Scripts (Logon/Logoff).
- Double-click either the Logon or Logoff policy that you want to configure, and select your script file accordingly.