Using Scripts in Group Policy

In Windows Server 2003 you can configure computer startup and shutdown scripts as well as user logon and logoff scripts. You can write these scripts as command-shell batch scripts ending with the .bat or .cmd extension or as scripts that use the Windows Script Host (WSH). WSH is a feature of Windows Server 2003 that lets you use scripts written in a scripting language, such as Microsoft JScript and Microsoft VBScript.

Configuring Computer Startup and Shutdown Scripts

You can assign computer startup and shutdown scripts as part of a group policy. In this way, all computers in a site, domain, or OU run scripts automatically when they're started or shut down.

To configure a script that should be using during computer startup or shutdown, follow these steps:

  1. For easy management, copy the scripts you want to use to the MachineScriptsStartup or MachineScriptsShutdown folder for the related policy. By default, policies are stored in the %SystemRoot%SysvolDomainPolicies folder on domain controllers.

  2. Start the Group Policy Object Editor. In the Group Policy Management console, rightclick the Group Policy you want to modify, and then select Edit.

  3. In the Computer Configuration node, double-click the Windows Settings folder, and then click Scripts.

  4. To work with startup scripts, right-click Startup, and then select Properties. Or rightclick Shutdown, and then select Properties to work with shutdown scripts.

  5. Click Show Files. If you copied the computer script to the correct location in the Policies folder, you should see the script.

  6. Click Add to assign a script. This opens the Add A Script dialog box. In the Script Name field, type the name of the script you copied to the MachineScriptsStartup or the MachineScriptsShutdown folder for the related policy. Repeat this step to add other scripts.

  7. During startup or shutdown, scripts are run in the order in which they're listed in the Properties dialog box. Use the Up or Down button to reposition scripts as necessary.

  8. To delete a script, select the script in the Script For list, and then click Remove.

Configuring User Logon and Logoff Scripts

You can assign logon and logoff scripts as part of a group policy. In this way, all users in a site, domain, or OU run scripts automatically when they log on or log off.

To configure a script that should be executed when a user logs on or logs off, complete the following steps:

  1. For easy management, copy the scripts you want to use to the UserScriptsLogon or the UserScriptsLogoff folder for the related policy. By default, policies are stored in the %SystemRoot%SysvolDomainPolicies folder on domain controllers.

  2. Start the Group Policy Object Editor. In the Group Policy Management console, rightclick the Group Policy you want to modify, and then select Edit.

  3. Double-click the Windows Settings folder in the User Configuration node, and then click Scripts.

  4. To work with logon scripts, right-click Logon, and then select Properties. Or rightclick Logoff, and then select Properties to work with logoff scripts.

  5. Click Show Files. If you copied the user script to the correct location in the Policies folder, you should see the script.

  6. Click Add to assign a script. This opens the Add A Script dialog box. In the Script Name field, type the name of the script you copied to the UserScriptsLogon or the UserScriptsLogoff folder for the related policy. Repeat this step to add other scripts.

  7. During logon or logoff, scripts are executed in the order in which they're listed in the Properties dialog box. Use the Up or Down button to reposition scripts as necessary.

  8. To delete a script, select the script in the Script For list, and then click Remove.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset