I'm often asked how to implement the execution of scripts within an Active Directory environment. Microsoft conveniently built script launching hooks into the group policy. Thus, as long as your client systems are Active Directory compliant, you can pre-configure scripts that are automatically launched.
The script controls are located in two different positions within a GPO. The first is under the Computer Configuration section, under Windows Settings, Scripts. The second is under the User Configuration section, also under Windows Settings, Scripts.
The script controls in the Computer Configuration section are used to define scripts that execute at startup (i.e. boot up) and shutdown (i.e. graceful shutdown). The script controls in the User Configuration section are used to define scripts that execute at logon and logoff.
All four controls use the same configuration interface dialog box. Through it you add or remove scripts and define their execution order. The most important scripts -- those which make critical changes to the system -- should be positioned to execute last. Scripts defined through the GPO run in sequential order. Thus, the second script will only launch once the first script completes its execution.
Once you've defined the scripts to execute at startup, shutdown, logon and logoff, the script files themselves are automatically transferred into the Active Directory database. This eliminates the need to define and maintain a network share for scripts manually. Instead, anywhere users can access Active Directory, they will also have access to the defined scripts.
Another great benefit to assigning scripts via AD's GPOs is that scripts can be uniquely tailored for each AD container: domain, site and organizational unit. Also, by setting read and deny access to GPOs on a container, you can designate the application of the GPO to certain users and groups.
James Michael Stewart is a researcher and writer for Lanwrights, Inc.