Scripts, in one form or another, have existed for years on just about all computer platforms from mainframes down to the PC. There has always been a common need to automatically configure a user session without user or administrator intervention. Group Policy can be used to assign scripts to run when the user logs on or off or when the computer is started or shut down. Script settings are provided in both the User and the Computer sections of the GPO. Benefits of GPO ScriptsA script can allow you either to standardize the setup of various users or computers or to supply a custom setup for certain users. It just depends on which script is assigned. Typically, a script will be written in whatever command language is available on the platform. Using Group Policy scripts allows the system administrator to centralize control over the application and data locations that aren't already defined by Folder Redirection. By defining drive mappings via a script instead of letting the user attempt to do it, the administrator is assured that all users will be working with an identical configuration. Because Group Policy scripts can be applied to a large number of users, the administrator can easily make changes to the configuration by just changing a script instead of having to visit each individual desktop. Scripts can also be used for various system maintenance activities. The administrator can add routines to delete the files in temporary directories, run disk utilities in the background, and various other activities. Group Policy scripts can be assigned to a user, a computer, a group of users, or all the users in an Organization Unit (OU), site, or domain. There can be different scripts for different departments or locations. If you are using some of the more featured batch languages for your scripts, you can have the script perform a different set of tasks, depending on what group or OU the user or computer may be assigned to. How Group Policy Scripts WorkIn Windows Server 2003, Group Policy scripts are stored in the Group Policy template stored with the GPO. This way, the script is automatically replicated among all the domain controllers. This is a big improvement from the previous versions of Windows NT, where the system administrator placed the scripts in the logon share and then had to manually configure the replication pattern for the network. This method was error prone, and the replication mechanism was infamous for replication failures, without presenting any errors. After the script is stored in the GPO, the system administrator assigns the script to one or more users or computers. This can be accomplished by applying the script via a Group Policy. When the user logs on to the domain or the computer is started, the script will run and perform whatever tasks the system administrator has coded in it. Note: Logon Scripts Although assigning a logon script to a user profile is still supported in Windows Server 2003, it can be quite tedious to assign scripts to a large number of users. In addition, it can be a nightmare to manage if the logon script names change frequently. The best solution is to assign logon scripts via Group Policy. This allows all changes to be performed in one place, and when assigning scripts using a Group Policy, you have the option of also assigning a logoff script. Unfortunately, Group Policies can be used only with Windows 2000 or later clients. In Step by Step 10.1 we're going to create a new GPO and use it to assign a logon script to an OU that we created in the exercises in Chapter 2. To perform this exercise, you will need to do the following:
Startup and Shutdown scripts are assigned to a computer, in contrast to the logon and logoff scripts, which are assigned to users. The startup and shutdown scripts are useful for making customizations to the computer that are not user specific. A good example of where a Group Policy Shutdown script would be useful is on a mail or a database server where background services must be stopped before the system can shut down. The procedure to assign Group Policy Startup and Shutdown scripts is similar to the steps covered in the Step by Step. They are assigned via the Group Policy console, under the Computer Configuration section. |