4 Protocol Examples
In the following example, when specific users log out, the following two commands are run:
-
\\managementserver\scripts\logtime.exe users \\archiveserver\logshare \\managementserver\scripts\OnLogoff.ps1 users \\archiveserver\logshare
Also, when those users log on, the following command sequence is run:
-
\\managementserver\scripts\OnLogon.ps1 users -verbose defrag.exe systemdrive \\managementserver\scripts\logstart.exe users -verbose
The following sequence of events occurs in this example:
The administrator invokes the administrative tool and uses the Group Policy: Core Protocol subsystem, which specifies to create settings for a given set of users, using the Group Policy: Scripts Extension Encoding plug-in.
The Group Policy: Scripts Extension Encoding plug-in to the administrative tool is invoked with a GPO path that it uses to construct a path to scripts.ini and psscripts.ini files. The plug-in tries to read these files and finds that they do not exist.
Because the files do not exist, the plug-in allows the administrator to enter commands to be used in new settings. When the administrator is done, the plug-in creates the following scripts.ini file:
[Logoff] 0CmdLine=\\managementserver\scripts\logtime.exe 0Parameters=users \\archiveserver\logshare [Logon] 0CmdLine=defrag.exe 0Parameters=systemdrive 1CmdLine=\\managementserver\scripts\logstart.exe 1Parameters=users -verbose
The plug-in also creates the following psscripts.ini file:
[ScriptConfig] StartExecutePSFirst=true EndExecutePSFirst=false [Logoff] 0CmdLine=\\managementserver\scripts\OnLogoff.ps1 0Parameters=users \\archiveserver\logshare [Logon] 0CmdLine=\\managementserver\scripts\OnLogon.ps1 0Parameters=users -verbose
The plug-in then copies the scripts.ini and psscripts.ini files to the remote location.
When the user logs on to a computer, the Group Policy: Core Protocol finds a GPO with the Group Policy: Scripts Extension Encoding CSE GUID, invokes the client plug-in, and gives it a GPO path. The client plug-in uses the GPO path to construct the path to the scripts.ini and psscripts.ini files, reads and parses the files, and then configures the command execution subsystem to execute the commands at the specified times.