Subscribe RSS Feed | Follow on Twitter

Running scripts on connect/reconnect

with 2 comments

Login scripts are very important to administrators because they can manage to connect network drives, printers ,do personalization of user session and a lot more. But what, if the user just reconnects after an RDP disconnect? In bank environments i.e. the users are working with hot desks very often where they disconnect a session move to another office or desk and just reconnect their session again.

When reconnecting the session the user gets his desktop back in the state he left it on disconnect. Applications are still open, network drives are mapped and also the printers will be available. But what if the user changed the location to another floor and needs to print on a different network printer over there? In this case you could use an option which is available since VMware View 3.01. The option provides the capability to execute scripts on the virtual desktop on connect and reconnect. These options are available through the vdm_agent.adm templates on the View Conncetion server. The need Registry keys are:


HKLM\Software\Policies\VMware, Inc.\VMware VDM\Agent\Configuration\CommandsToRunOnConnect and  
HKLM\Software\Policies\VMware, Inc.\VMware VDM\Agent\Configuration\CommandsToRunOnReconnect


The command/scripts to run are defined as a name/value pair where the value is the command to be executed:


Command1 = CMD /C c:\script1.vbs
Command2 = CMD /C c:\script2.vbs


With those functionality and the possibility to grab the client name of  the connecting device trough environment variable: ViewClient_Machine_Name it is possible to execute an script which will check the clients host name, check the location against an text file or database and map the correct printer on the floor when connecting/reconnecting to the virtual desktop session.

Similar Posts:

Written by Christoph Harding

April 24th, 2009 at 11:56 am

  • Joe Chin

    Hi Christoph, I am trying to implement a connect/reconnect script. I was wondering if in View 4 the registry location for these keys had changed? is it now located at
    [HKEY_LOCAL_MACHINESOFTWAREVMware, Inc.VMware VDMAgentConfiguration]?

    Joe Chin

  • Christoph Harding

    Hi Joe,

    I rechecked it with the vdm_agent.adm file but the registry keys are still the same.

    “SoftwarePoliciesVMware, Inc.VMware VDMAgentConfigurationCommandsToRunOnConnect”

    “SoftwarePoliciesVMware, Inc.VMware VDMAgentConfigurationCommandsToRunOnReconnect”



By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.