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.