You must add Windows registry entries on each View desktop virtual machine where you want View to run a start session script.

Before you begin

  • 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 Making Start Session Scripts Accessible.

  • 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 View Connection Server sends. For more information, see Managing Start Session Timeouts.

Procedure

  1. Log in to the View desktop virtual machine.
  2. At the command prompt, type regedit to start the Windows Registry Editor.
  3. In the registry, navigate to HKLM\SOFTWARE\VMware, Inc.\VMware VDM\ScriptEvents.
  4. Add the path to the start session script to the registry.
    1. In the navigation area, right-click ScriptEvents, select New > Key, and create a key named StartSession.
    2. In the navigation area, right-click StartSession, select New > String Value, 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.

    3. In the topic area, right-click the entry for the new string value and select Modify.
    4. 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.

  5. Add and enable a start session value in the registry.
    1. Navigate to HKLM\SOFTWARE\VMware, Inc.\VMware VDM\Agent\Configuration.
    2. (Optional) : If the Configuration key does not exist, right-click Agent, select New > Key, and create the key.
    3. In the navigation area, right-click Configuration, select New > DWORD (32 bit) Value, and type RunScriptsOnStartSession.
    4. In the topic area, right-click the entry for the new DWORD value and select Modify.
    5. 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.

    6. (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.

  6. 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 View Connection Server timeout occurs.

    1. Navigate to HKLM\SOFTWARE\VMware, Inc.\VMware VDM\ScriptEvents.
    2. Add a DWORD value called TimeoutsInMinutes.
    3. Set a data value of 0.
  7. (Optional) : To enable the VMware View Script Host service to time out the start session script, set a timeout value.
    1. Navigate to HKLM\SOFTWARE\VMware, Inc.\VMware VDM\ScriptEvents\StartSession.
    2. In the topic area, right-click the Default (@) key and select Modify.
    3. In the Value data text box, type the timeout value and click OK.

      A value of 0 means that no timeout is set.

  8. Exit the Registry Editor and restart the system.