WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

How To
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Specify a Script to Run on Startup Shutdown Logon Logoff

 Keywords:  2000 XP 2k Startup Shutdown Logon Logoff script deployment

NOTICE:

IntControl 1005 was removed from documentation as it did not work as people wished. It worked on on Windows 95/98/ME machines, but was not at all satifactory on NT/2000/XP/2003 machines.

WORKAROUND:

This is a possible workaround for IntControl 1005 on NT platforms. The idea is to Launch a WinBatch service (.exs) and have it monitor for the Shutdown/Logoff message, execute any shutdown/logoff code then exit! You can install the service on the fly using wntSvcCreate then start it using wntSvcStart. http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/Functions+IntControl~1005.txt

You can also specify a script to run at shutdoan or logoff using Windows Group Policy settings.


Group Policy in Windows 2000 and XP, includes two options for script deployment:

Note: If running on earlier platforms (95/98/ME/NT 4), see the function IntControl 1005.

To open the Group Policy snap-in

Open Group Policy by clicking Start, clicking Run, and then type gpedit.msc

To Assign computer startup scripts

  1. Open the Group Policy snap-in.
  2. In the console tree, click Scripts (Startup/Shutdown).
    	policy name Policy | Computer Configuration | Windows Settings | Scripts (Startup/Shutdown)
    	

  3. In the details pane, double-click Startup.

  4. In the Startup Properties dialog box, click Add.

  5. In the Add a Script dialog box, type the following information, and then click OK:

    Script Name: Type the path to the script, or click Browse to search for the script file in the Netlogon share of the domain controller.

    Script Parameters: Type any parameters that you want, the same way as you would type them on the command line. For example, if your script includes parameters called //logo (display banner) and //I (interactive mode), type the following: //logo //I

  6. In the Startup Properties dialog box, specify the options that you want, as follows, and then click OK:

    Startup Scripts for Group Policy object: Lists all the scripts that are currently assigned to the selected Group Policy object. If you assign multiple scripts, the scripts are processed in the order that you specify. To move a script up in the list, click it, and then click Up. To move a script down in the list, click it, and then click Down.

    Add: Opens the Add a Script dialog box, where you can specify any additional scripts to use.

    Edit: Opens the Edit Script dialog box, where you can modify script information, such as name and parameters.

    Remove: Removes the selected script from the Startup Scripts list.

    Show Files: Displays the script files that are stored in the selected Group Policy object.

Notes:
Startup scripts are run as Local System, and they have the full rights that are associated with being able to run as Local System.


To Assign computer shutdown scripts

  1. Open the Group Policy snap-in.
  2. In the console tree, click Scripts (Startup/Shutdown).
    		policy name Policy | Computer Configuration | Windows Settings | Scripts (Startup/Shutdown)
    		

  3. In the details pane, double-click Shutdown.

  4. In the Shutdown Properties dialog box, click Add.

  5. In the Add a Script dialog box, type the following information, and then click OK:

    Script Name: Type the path to the script, or click Browse to search for the script file in the Netlogon share of the domain controller.

    Script Parameters: Type any parameters that you want, the same way that you would type them on the command line. For example, if your script includes parameters called //logo (display banner) and //I (interactive mode), type the following: //logo //I

  6. In the Shutdown Properties dialog box, specify the options that you want, as follows, and then click OK:

    Shutdown Scripts for Group Policy object: Lists all the scripts that are currently assigned to the selected Group Policy object. If you assign multiple scripts, the scripts are processed in the order that you specify. To move a script up in the list, click it, and then click Up. To move a script down in the list, click it, and then click Down.

    Add: Opens the Add a Script dialog box, where you can specify any additional scripts to use.

    Edit: Opens the Edit Script dialog box, where you can modify script information, such as name and parameters.

    Remove: Removes the selected script from the Shutdown Scripts list.

    Show Files: Displays the script files that are stored in the selected Group Policy object.

Note:
Shutdown scripts are run as Local System, and they have the full rights that are associated with being able to run as Local System.


To Assign user logon scripts

  1. Open the Group Policy snap-in.

  2. In the console tree, click Scripts (Logon/Logoff).
    policy name Policy | User Configuration | Windows Settings | Scripts (Logon/Logoff)

  3. In the details pane, double-click Logon.

  4. In the Logon Properties dialog box, click Add.

  5. In the Add a Script dialog box, type the following information, and then click OK:

    Script Name: Type the path to the script, or click Browse to search for the script file in the Netlogon share of the domain controller.

    Script Parameters: Type any parameters that you want, the same way as you would type them on the command line. For example, if your script includes parameters called //logo (display banner) and //I (interactive mode), type the following: //logo //I

  6. In the Logon Properties dialog box, specify the options that you want, as follows, and then click OK:

    Logon Scripts for Group Policy object: Lists all the scripts that are currently assigned to the selected Group Policy object. If you assign multiple scripts, the scripts are processed in the order that you specify. To move a script up in the list, click it, and then click Up. To move a script down in the list, click it, and then click Down.

    Add: Opens the Add a Script dialog box, where you can specify any additional scripts to use.

    Edit: Opens the Edit Script dialog box, where you can modify script information, such as name and parameters.

    Remove: Removes the selected script from the Logon Scripts list.

    Show Files: Displays the script files that are stored in the selected Group Policy object.

Note:
Logon scripts are run as User, not Administrator, and their rights are limited accordingly.


To Assign user logoff scripts

  1. Open the Group Policy snap-in.
  2. In the console tree, click Scripts (Logon/Logoff).
    policy name Policy | User Configuration | Windows Settings | Scripts (Logon/Logoff)

  3. In the details pane, double-click Logoff.

  4. In the Logoff Properties dialog box, click Add.

  5. In the Add a Script dialog box, type the following information, and then click OK:

    Script Name: Type the path to the script, or click Browse to search for the script file in the Netlogon share of the domain controller.

    Script Parameters: Type any parameters that you want, the same way as you would type them on the command line. For example, if your script includes parameters called //logo (display banner) and //I (interactive mode), type the following: //logo //I

  6. In the Logoff Properties dialog box, specify the options the you want, as follows, and then click OK:

    Logoff Scripts for Group Policy object: Lists all the scripts that are currently assigned to the selected Group Policy object. If you assign multiple scripts, the scripts are processed in the order that you specify. To move a script up in the list, click it, and then click Up. To move a script down in the list, click it, and then click Down.

    Add: Opens the Add a Script dialog box, where you can specify any additional scripts to use.

    Edit: Opens the Edit Script dialog box, where you can modify script information, such as name and parameters.

    Remove: Removes the selected script from the Logoff Scripts list.

    Show Files: Displays the script files that are stored in the selected Group Policy object.

Note:
Logoff scripts are run as User, not Administrator, and their rights are limited accordingly.


To Set up scripts on the domain controller

Copy the script and dependent files to the Netlogon share, or other share, of the domain controller from which you want the script to run.


Article ID:   W15169
File Created: 2014:07:18:09:51:38
Last Updated: 2014:07:18:09:51:38