Add Windows Registry Entries for a Start Session Script
To make a start session script available for execution, you must add the path to the script in the Windows registry. You also must add and enable a start session value, RunScriptsOnStartSession, in the registry. To prevent scripts from timing out, you should set a registry value to specify timeout values in seconds rather than minutes. Finally, you can set additional, optional entries to govern timeout values.
You must create these registry entries on each View desktop virtual machine where you want to run a start session script.
To add Windows registry entries to enable a start session script on a View desktop virtual machine
In the registry, navigate to HKLM\SOFTWARE\VMware, Inc.\VMware VDM\ScriptEvents.
In the navigation area, right-click ScriptEvents, select New > Key, and create a key named StartSession.
In the navigation area, right-click StartSession, select New > String Value, and create a string value that identifies the start session script to be 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 specified order, invoke them from a single control script.
In Value data, enter the command line that invokes the start session script and click OK.
Specify the full path of the start session script and any files that it requires.
Navigate to HKLM\SOFTWARE\VMware, Inc.\VMware VDM\Agent\Configuration.

If a Configuration key does not exist, right-click Agent, select New > Key, and create the key.
In the navigation area, right-click Configuration, select New > DWord (32 bit) Value, and type RunScriptsOnStartSession.
In Value data, type 1 to enable start session scripting. Type 0 to disable this feature. 0 is the default value.
(Optional) To delay the StartSession response by View Agent, add a second DWord value to the Configuration key called WaitScriptsOnStartSession.

A WaitScriptsOnStartSession data value of 1 causes View Agent to delay sending a StartSession response and fail if the scripts do not complete. A value of 0 means that View Agent does not wait for the scripts to complete or check script exit codes before sending the StartSession response. The default value is 0.
Navigate to HKLM\SOFTWARE\VMware, Inc.\VMware VDM\ScriptEvents.
Add a DWord value called TimeoutsInMinutes.
Setting this timeout value in seconds allows you to configure the VMware View Script Host service timeout value in seconds. For example, if you set the Script Host service timeout to 30 seconds, you can ensure that a start session script will either finish running or time out before a View Connection Server timeout occurs.
(Optional) To enable the VMware View Script Host service to time out the start session script, navigate to HKLM\SOFTWARE\VMware, Inc.\VMware VDM\ScriptEvents\StartSession. Right click the Default (@) key, select Modify, enter the timeout value in milliseconds, and click OK. A value of 0 means that no timeout is set.