You must add Windows registry entries on each Horizon desktop virtual machine where you want Horizon to run a start session script.
- Verify that the path where you configured your start session scripts is accessible only to the SYSTEM account and local administrators. For more information, see Best Practices for Using Start Session Scripts.
- Make sure your start session scripts run quickly. If you set the WaitScriptsOnStartSession value in the Windows registry, your start session script must finish running before Horizon Agent can respond to the StartSession message that Horizon Connection Server sends. For more information, see Best Practices for Using Start Session Scripts.
- Log in to the Horizon desktop virtual machine.
- At the command prompt, type regedit to start the Windows Registry Editor.
- In the registry, navigate to HKLM\SOFTWARE\VMware, Inc.\VMware VDM\ScriptEvents.
- Add the path to the start session script to the registry.
- In the navigation area, right-click ScriptEvents, select , and create a key named StartSession.
- In the navigation area, right-click StartSession, select , and create a string value that identifies the start session script to run, for example, SampleScript.
To run more than one start session script, create a string value entry for each script under the StartSession key. You cannot specify the order in which these scripts run. If the scripts must run in a particular order, invoke them from a single control script.
- In the topic area, right-click the entry for the new string value and select Modify.
- In the Value data text box, type the command line that invokes the start session script and click OK.
Type the full path of the start session script and any files that it requires.
- Add and enable a start session value in the registry.
- Navigate to HKLM\SOFTWARE\VMware, Inc.\VMware VDM\Agent\Configuration.
- (Optional) If the Configuration key does not exist, right-click Agent, select , and create the key.
- In the navigation area, right-click Configuration, select , and type RunScriptsOnStartSession.
- In the topic area, right-click the entry for the new DWORD value and select Modify.
- In the Value data text box, type 1 to enable start session scripting and click OK.
You can type 0 to disable this feature. The default value is 0.
- (Optional) To delay the StartSession response by Horizon Agent, add a second DWORD value to the Configuration key called WaitScriptsOnStartSession.
A WaitScriptsOnStartSession data value of 1 causes Horizon Agent to delay sending a StartSession response and fail if the scripts do not complete. A value of 0 means that Horizon Agent does not wait for the scripts to complete or check script exit codes before sending the StartSession response. The default value is 0.
- Set a registry value to specify timeout values in seconds rather than minutes to prevent scripts from timing out.
Setting this timeout value in seconds enables you to configure the VMware View Script Host service timeout value in seconds. For example, if you set the VMware View Script Host service timeout to 30 seconds, you can ensure that a start session script either finishes running or times out before a Connection Server timeout occurs.
- Navigate to HKLM\SOFTWARE\VMware, Inc.\VMware VDM\ScriptEvents.
- Add a DWORD value called TimeoutsInMinutes.
- Set a data value of 0.
- (Optional) To enable the VMware View Script Host service to time out the start session script, set a timeout value.
- Navigate to HKLM\SOFTWARE\VMware, Inc.\VMware VDM\ScriptEvents\StartSession.
- In the topic area, right-click the Default (@) key and select Modify.
- In the Value data text box, type the timeout value and click OK.
A value of 0 means that no timeout is set.
- Exit the Registry Editor and restart the system.