5.5. Running a Task via Group Policy
You want to configure Group Policy so that a task runs at system startup or shutdown or when a user logs on or off.
Using a graphical user interface
Open the Group Policy Management Console (gpmc.msc).
In the left pane, browse to the Group Policy Object you want to edit.
Right-click on it and select Edit. This will launch the Group Policy Object Editor.
If you want a task to run during user logon or logoff:
Expand User Configuration → Windows Settings and click on the Scripts icon.
In the right pane, double-click on Logon to configure a script to run at user logon or double-click Logoff to configure a script to run at user logoff.
If you want a task to run during system startup or shutdown:
Expand Computer Configuration → Windows Settings and click on the Scripts icon.
In the right pane, double-click on Startup to configure a script to run at system start or double-click Shutdown to configure a script to run at system shutdown.
Click the Add button.
Fill in Script Name and Script Parameters and click OK.
You have two options for where you can store the scripts or commands you run via group policy. One option is to specify a UNC path to the script (this could reference a remote file server), in the Script Name field. The key here is that all users that the Group Policy applies to must have at least read-only access to the script with their domain account. The second method is to copy the script to the folder within the ...