User and Computer Script Management


User and Computer Script Management

With Windows Server 2003 you can configure four types of scripts:

  • Computer Startup

    Executed during startup

  • Computer Shutdown

    Executed prior to shutdown

  • User Logon

    Executed when a user logs on

  • User Logoff

    Executed when a user logs off

You can write 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 VBScript, without the need to insert the script into a Web page. To provide a multipurpose scripting environment, WSH relies on scripting engines. A scripting engine is the component that defines the core syntax and structure of a particular scripting language. Windows Server 2003 ships with scripting engines for VBScript and JScript. Other scripting engines are also available.

Assigning Computer Startup and Shutdown Scripts

Computer startup and shutdown scripts are assigned as part of a group policy. In this way, all computers that are members of the site, domain, or organizational unit, or all three, execute scripts automatically when they're booted or shut down.

Note

You can also assign computer startup scripts as scheduled tasks. You schedule tasks using the Scheduled Task Wizard. See the "Scheduling Tasks " section of this chapter for details.


To assign a computer startup or shutdown script, follow these steps:

  1. For easy management, copy the scripts you want to use to the Machine\ Scripts\Startup or Machine\Scripts\Shutdown folder for the related policy. Policies are stored in the %SystemRoot%\Sysvol\Domain\Policies folder on domain controllers.

  2. Access the Group Policy console for the site, domain, or organizational unit you want to work with.

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

  4. To work with startup scripts, right-click Startup and then select Properties. Or right-click Shutdown and then select Properties to work with Shutdown scripts. This opens a dialog box similar to the one shown in Figure 4-8.

  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 Machine\ Scripts\Startup or the Machine\Scripts\Shutdown folder for the related policy. In the Script Parameters field, enter any command-line arguments to pass to the command-line script or parameters to pass to the scripting host for a WSH script. Repeat this step to add other scripts.

    Figure 4-8. Add, edit, and remove computer scripts using the Shutdown Properties dialog box.

    graphics/f04ap08.jpg

  7. During startup or shutdown, 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. If you want to edit the script name or parameters later, select the script in the Script For list and then click Edit.

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

Assigning User Logon and Logoff Scripts

You can assign user scripts in one of three ways:

  • You can assign logon and logoff scripts as part of a group policy. In this way, all users that are members of the site, domain, or organizational unit, or all three, execute scripts automatically when they log on or log off.

  • You can also assign logon scripts individually through the Active Directory Users And Computers console. In this way, you can assign each user or group a separate logon script. For details, see the section entitled "Configuring the User's Environment Settings" in Chapter 10 , "Managing Existing User and Group Accounts."

  • You can also assign individual logon scripts as scheduled tasks. You schedule tasks using the Scheduled Task Wizard. See the "Scheduling Tasks" section of this chapter for details.

To assign a group policy user script, complete the following steps:

  1. For easy management, copy the scripts you want to use to the User\Scripts\ Logon or the User\Scripts\Logoff folder for the related policy. Policies are stored in the %SystemRoot%\Sysvol\Domain\Policies folder on domain controllers.

  2. Access the Group Policy console for the site, domain, or organizational unit you want to work with.

  3. Double-click the Windows Settings folder in the User Configuration node. Then click Scripts.

  4. To work with logon scripts, right-click Logon and then select Properties. Or right-click Logoff and then select Properties to work with logoff scripts. This opens a dialog box similar to the one shown in Figure 4-9.

    Figure 4-9. Add, edit, and remove user scripts using the Logon Properties dialog box.

    graphics/f04ap09.jpg

  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 User\Scripts\Logon or the User\Scripts\Logoff folder for the related policy. In the Script Parameter field, enter any command-line arguments to pass to the command-line script or parameters to pass to the scripting host for a WSH script. 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. If you want to edit the script name or parameters later, select the script in the Script For list and then click Edit.

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



Microsoft Windows Server 2003 Administrator[ap]s Pocket Consultant
Microsoft Windows Server 2003 Administrator[ap]s Pocket Consultant
ISBN: 735622450
EAN: N/A
Year: 2003
Pages: 141

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net